I have to create a 2d array with unknown size. So I have decided to go with a 2d ArrayList the problem is I\'m not sure how to initialize such an array or store information.
Since you only need to store booleans in that 2D array, I would say the most suitable data structure (as both memory consumption and useful interface) would be a java.util.BitSet, which is basically a class that models a bit array:
As it's a 2D array, I think the way to go would be a:
List bitArrays = new ArrayList();
In the List, you cannot just say: "here's the 5th element" without inserting the first 4 elements. But in the BitSet, you can simply set() whatever bit you need and it will automatically expand to the required size.