Object array to int array?
ArrayList<Integer> in = new ArrayList<Integer>();
When using the ArrayList method toArray() it returns Object, how would I go about converting this to int?
Found java.lang.Object but expected int
The most "obvious" solution i tried was a cast..but of course to no surprise i cant do that with an array.
am i forced to pull each entry from the List using a loop?
Re: Object array to int array?
Yes thats correct, you will come across some issues doing this, however you can convert your list of Integer into an array of Integer with no big problems, its just the matter of converting it to an array of primitives you will need to loop through the indexes I believe.
Auto (un)boxing is only so good I'm afraid :(
final List<Integer> intList = new ArrayList<Integer>();
final Integer intArray = intList.toArray(new Integer[intList.size()]);