I need to improve my Java 8 game. I was looking for a comparison; Groovy List Closure operations vs. Java 8 Stream operations. @sujeet100's post delivered.
Moreover, I got a better understanding of how Java 8 Streams work:
The stream operations in Java 8 are not evaluated horizontally but are evaluated vertically, i.e. each element of the stream moved vertically down the chain. That’s why when a book matched the mentioned filter criteria, it is passed to the next operation in chain and the evaluation of other stream elements is delayed. This allows us to create a stream of infinite elements since all the elements are not loaded at once and are not evaluated for every operation in the chain. While working on bigger data, this might be a performance boon.
Although I still prefer Scala and Groovy succinctness, streams are a step in the right direction.