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
This code segment is working for me, try this:
Integer[] arr = x.toArray(new Integer[x.size()]);
Worth to mention ArrayList should be declared like this:
ArrayList list = new ArrayList<>();