how to initialize a 2d arraylist in hava code example
Example 1: creating a 2d arraylist in java
List<List<String>> listOfLists = new ArrayList<List<String>>(size);
for(int i=0; i<size; i++) {
listOfLists.add(new ArrayList<String>());
}
Example 2: how to create a 2d arraylist java
ArrayList<ArrayList<Object>> a = new ArrayList<ArrayList<Object>>();