1int vertexCount = 3;
2ArrayList<ArrayList<Integer>> graph = new ArrayList<>(vertexCount);
3//Next, we'll initialize each element of ArrayList with another ArrayList:
4
5for(int i=0; i < vertexCount; i++) {
6 graph.add(new ArrayList());
7}
1List<List<String>> listOfLists = new ArrayList<List<String>>(size);
2for(int i=0; i<size; i++) {
3 listOfLists.add(new ArrayList<String>());
4}