I am trying to use 2D arrayLists in Java. I have the definition:
ArrayList> myList = new ArrayList
Assuming the matrix is not initialized,
int m = 10, n = 10; ArrayList> matrix = new ArrayList>(); for (int i = 0; i < m; i++) { List row = new ArrayList(); for (int j = 0; j < n; j++) { row.add(j); } matrix.add(row); }