I would like to use code similar to the following:
int letterIndex[];
LinkedList<Integer> letterList;
...
if(!letterList.isEmpty()) letterIndex = (Integer[])letterList.toArray();
However, it is not allowed, and apparently the cast to Integer[]
is not autoboxed when converting to int[]
. How would I accomplish the equivalent without declaring letterIndex
as Integer[]
instead of int[]
?
– bestsss Mar 23 '11 at 22:41