I have always had this one issue with arrays of ArrayLists. Maybe you can help.
//declare in class
private ArrayList<Integer>[] x;
//in constructor
x=new ArrayList[n];
This generates a warning about unchecked conversion.
But
x=new ArrayList<Integer>[n];
is a compiler error.
Any idea?
Thanks!
You can’t make a array of generics lists. Fortunately, there are workarounds. And even more fortunately, there is a nice site about Generics with more information than you’d ever want to know. The link goes straight to the Arrays in Java Generics part.