Log in

View Full Version : Convert arraylist to an array of arraylist!


BeWahtEver
Apr 19, 2012, 04:12 PM
I do have an ArrayList and I want to convert it to an array of arrayList.

I have a class X that has an ArrayList. And In the main class , I have an ArrayList that has many X objects. I want to create a new Array of ArrayList Y[ ] that has the element of the ArrayList from X in my ArrayList. How can I do this? Here is my code...
class X {
ArrayList<Double> data;

X() {
data = new ArrayList<Double>();
}

public class C{
ArrayList<X> XX = new ArrayList<X>();

ArrayList Y[]=null;
// Now I want to convert XX to Y[ ]

}