Does anyone know how to fix this warning?
MyMain.java:12: warning: [unchecked] unchecked conversion
found : java.util.ArrayList[][]
required: java.util.ArrayList<java.lang.String>[][]
obj[count].someArrayList = new ArrayList[4][4];
I tried to change this to:
obj[count].someArrayList = new ArrayList<String>[4][4];
But the amendment changes the warning into the following error:
MyMain.java:12: generic array creation
obj[count].someArrayList = new ArrayList<String>[4][4];
The declaration of someArrayList is:
public ArrayList<String>[][] someArrayList;
You cannot create arrays with generics (hence the error). The warning indicates the heavily discouraged use of raw types with an
ArrayList.Instead, the following creates a multidimensional
ArrayList:public ArrayList<ArrayList<String>> someArrayList;You can then perform normal operations on your multidimensional
ArrayList.