February 2014
Intermediate to advanced
160 pages
4h 59m
English
In previous chapters we’ve seen the facilities that the new 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 quite 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 ...