how to print the elements of a list java code example
Example 1: print list in java 8
list.forEach(System.out::println);
Example 2: how to print list contents in java
System.out.println(Arrays.toString(list.toArray()));
list.forEach(System.out::println);
System.out.println(Arrays.toString(list.toArray()));