here is what i have got
ArrayList<Integer> list = new ArrayList<Integer>();
Integer a = 50;
Integer b = 55;
Integer c = 98;
Integer d = 101;
list.add(a);
list.add(b);
list.add(c);
list.add(d);
now i want to convert this “list” to an Array…
e.g.:
Integer[] actual= {50,55,98,101};
anyway how to do it? thanks.
If you want an
int[]array, you’ll have to loop over the list and unbox each element explicitly.See http://download.oracle.com/javase/6/docs/api/java/util/List.html next time you’re looking for a method of List.