I saw a code in java 8 to iterate a collection.
List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
numbers.forEach(System.out::println);
What is the functionality of System.out::println
? And how the above code can iterate through the List.
And what is the use of the operator ::
, Where else we can use this operator ?