Friday, April 6, 2012

[JAVA] ArrayList from array

It's easy to make array from collection, but visa-versa might look a bit more complicated. But it's not really if you know appropriate static method of certain built-in utility classes. As simple as it can be:

Integer[] arrayOfInts = new Integer[10];

List<Integer> listOfInts = Arrays.asList( arrayOfInts );

No comments:

Post a Comment