How is takeWhile() different from filter() in Java 9. What extra utility does it have?
Stream.of(1,2,3,4,5,6,7,8,9,10).filter(i -> i < 4 )
.forEach(System.out::println);
This is perhaps what following would do
Stream.of(1,2,3,4,5,6,7,8,9,10).takeWhile(i -> i < 4 )
.forEach(System.out::println);
What was the need of this new function then?