Two Dimensional ArrayList

java

Solution

Yes, it's possible. Just have the elements of your `ArrayList` also be `ArrayLists`.

ArrayList<ArrayList<Integer>> twoDArrayList = new ArrayList<ArrayList<Integer>>();

This would work with not just `ArrayLists`, but other collection types as well.

Problem

I know that I can add a dimension to an array by adding another [] beside it. But can I have more than one Dimension in a java.util.ArrayList? How might I accomplish this?

Original source

Related problems