I have an ArrayList
List<List<Integer>> nestedlists = new ArrayList<>();
How to iterate this list using forEach and lambda Expression.
for example an Arraylist can be iterated as:-
List<Integer> singlelist = new ArrayList<>();
singlelist.forEach((ele)->System.out.println(ele));
How to do the same for ArrayList containing Arraylists.
list.forEach(x -> x.forEach(y -> System.out.println(y)));or perhaps with better names:list.forEach(sub -> sub.forEach(i -> System.out.println(i)));nestedLists.forEach(sub -> sub.forEach(i -> System.out.println(i)));?