July 2023
Intermediate to advanced
276 pages
6h 55m
English
In previous chapters we’ve seen the facilities that the Stream interface offers, but so far we haven’t discussed one of their most salient features—they’re really lazy, in a good way. The lazy evaluation of Streams is powerful. First, we don’t have to do anything special to derive their benefits. In fact, we’ve used them many times already! Second, they can postpone not just one, but a sequence of evaluations so that only the most essential parts of the logic are evaluated, and only when needed. Let’s look at how lazy Streams are and how we benefit from that.
Streams have two types of methods: intermediate and terminal, which work together. The secret behind their laziness ...
Read now
Unlock full access