I want to have an array of ArrayLists:
ArrayList<MyClass>[] myArray;
I want to initialize it by the following code:
myArray = new ArrayList<MyClass>[2];
But I get this error:
Cannot create a generic array of ArrayList<MyClass>
How can I initialize it?
ArrayList<ArrayList<MyClass>>new ArrayList<MyClass>[2];tonew ArrayList[2];it will work but you will get warning. Not that I am recommending it though.