List<int[][]> matrices = new ArrayList<>();
my arraylist is this. I wanna print all the elements in 2-d arrays which store into the arrayList. How can I do this ?
I tried some solutions here but these are not working for me.
List<int[][]> matrices = new ArrayList<>();
my arraylist is this. I wanna print all the elements in 2-d arrays which store into the arrayList. How can I do this ?
I tried some solutions here but these are not working for me.
Iterate the list, and use Arrays.deepToString
to print each element:
matrices.stream()
.map(Arrays::deepToString)
.forEach(System.out::println);
Or, for versions of Java which don't support streams:
for (int[][] matrix : matrices) {
System.out.println(Arrays.deepToString(matrix));
}