I\'m trying to convert an ArrayList containing Integer objects to primitive int[] with the following piece of code, but it is throwing compile time error. Is it possible to
You can simply copy it to an array:
int[] arr = new int[list.size()]; for(int i = 0; i < list.size(); i++) { arr[i] = list.get(i); }
Not too fancy; but, hey, it works...