In normal array list initialization, We used to define generic type as follows,
List list1 = new ArrayList();
B
Something like this:
List> matrix = new ArrayList>(); for (int i = 0; i < numRows; ++i) { List row = new ArrayList(); // add some values into the row matrix.add(row); }
Make the type of the inner List anything you want; this is for illustrative purposes only.