I have got a loop with 2d list where I delete and add elements and want to add those temporary arraylists to the dimensions of another list.
Example,
// 2d list
List<List<Integer>> p = new ArrayList<List<Integer>>();
// 3d list
List<List<List<List<Integer>>>> list1 = new ArrayList<List<List<List<Integer>>>>();
// this compiles ok
list1.get(0).add(p);
but I get the following error:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
list1. It's empty.