Typecast a ArrayList.toArray() in Java to normal array
Posted
by Marthin
on Stack Overflow
See other posts from Stack Overflow
or by Marthin
Published on 2010-05-20T10:50:09Z
Indexed on
2010/05/20
11:20 UTC
Read the original article
Hit count: 286
I'm having some trouble to do the following:
int[] tmpIntList = (int[])MyArrayList.toArray(someValue);
MyArrayList contains only numbers. I get a typecast error since ArrayList
only returns Object[]
but why isnt it possible to turn it into a int[]
?
© Stack Overflow or respective owner