Also from guava libraries... com.google.common.primitives.Ints:
in Java? - Stack Overflow
List<Integer> Ints.asList(int...)
The easiest way to do this is to make use of Apache Commons Lang. It has a handy ArrayUtils class that can do what you want. Use the
toPrimitive method with the overload for an array of Integers.List<Integer> myList;
... assign and fill the list
int[] intArray = ArrayUtils.toPrimitive(myList.toArray(new Integer[myList.size()]));
Read full article from arrays - How to convert int[] into List
No comments:
Post a Comment