I have the following List to keep 3x3 matrix values:
1 2 3
4 5 6
7 8 9
List<List<Integer>> list = new ArrayList<>();
I want to add matrix values as shown below:
list.add(0, new ArrayList<Integer>{1, 2, 3});
list.add(1, new ArrayList<Integer>{4, 5, 6});
list.add(2, new ArrayList<Integer>{7, 8, 9});
But encounter syntax error. So, is it the correct way, or what is the proper way to assign matrix values by using cascade list?