Stream.peek() method in Java 8 vs Java 9
I assume you are running this under Java 9? You are not altering the SIZED property of the stream, so there is no need to execute either map or peek at all. In other words all you care is about count as the final result, but in the meanwhile you do not alter the initial … Read more