I have seen the following code in many Java 8 reference materials and examples:
List <Integer> l = Arrays.asList(7, 3, 9, 8, 6, 5, -1, -100);
l.stream().filter(y -> y <l.get(0)).collect(Collectors.toList()).
forEach(System.out::println);
However, I am able to get the same result using:
l.stream().filter(y -> y <l.get(0)).forEach(System.out::println);
So, what is the sanctity of using collect(Collectors.toList()) that's used almost ubiquitously?