I create a list of lists like this:
List tmp = new ArrayList(2);
Then I\'d like to insert 10 to first sub-list as follo
You've created an empty list with initial capacity of 2
(i.e. the internal representation of the list won't be resized until you've added 2 elements to it and are adding the third).
Then you try to get the first element from the empty list. Naturally this won't work. You need to first add()
as many inner lists (presumably 2) as you want, and then fill those inner lists.