how to iterate two dimensional arraylist in java

Solutions on MaxInterview for how to iterate two dimensional arraylist in java by the best coders in the world

showing results for - "how to iterate two dimensional arraylist in java"
Anthea
01 Mar 2019
1//using enhanced-for loop to iterate over two dimensional ArrayList
2List<List<T>> items = new ArrayList<>(Arrays.asList(
3                        Arrays.asList(T ...items),
4                		Arrays.asList(T ...items1),
5  						Arrays.asList(T ...items2)
6					));
7
8for (List<T> arr : items) {
9    for (T item : arr) {
10        System.out.print(item + " ");
11    }
12   System.out.println();
13 }
14