Arrays.asList
is expecting a variable number of Object
. int
is not an Object
, but int[]
is, thus Arrays.asList(A)
will create a List<int[]>
with just one element.
You can use IntStream.of(A).boxed().collect(Collectors.toList());
More Related Contents:
- What’s the difference between Instant and LocalDateTime?
- How to parse/format dates with LocalDateTime? (Java 8)
- Can Java 8 code be compiled to run on Java 7 JVM?
- How to install Java 8 on Mac
- Class has been compiled by a more recent version of the Java Environment
- Android Studio Error: Error:CreateProcess error=216, This version of %1 is not compatible with the version of Windows you’re running
- How can I create a stream from an array?
- Why does this generic code compile in java 8?
- Sum values from specific field of the objects in a list
- How do I define a method which takes a lambda as a parameter in Java 8?
- Why are Java 8 lambdas invoked using invokedynamic?
- Why do Consumers accept lambdas with statement bodies but not expression bodies?
- Most efficient way to get the last element of a stream
- Java 8 Stream IllegalStateException: Stream has already been operated on or closed
- Horrendous performance & large heap footprint of Java 8 constructor reference?
- Super class method and Interface default method conflict resolution
- Java idiom for lambdas with non-SAM interfaces
- Modifying Objects within stream in Java8 while iterating
- Take every nth element from a Java 8 stream
- Static context cannot access non-static in Collectors
- How can I parse/format dates with LocalDateTime? (Java 8)
- Valid usage of Optional type in Java 8
- installing JDK8 on Windows XP – advapi32.dll error
- Java 8, how can I implement a switch statement using streams?
- How to set format of string for java.time.Instant using objectMapper?
- When is an interface with a default method initialized?
- java: Arrays.sort() with lambda expression
- NoClassDefFoundError sun/io/ByteToCharConverter with InterBase JDBC driver
- Spring + AspectJ weaving for java 8 using aspectj-maven-plugin
- Visualization of Java Stream parallelization