O'Reilly logo

Mastering Lambdas by Maurice Naftalin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

image

CHAPTER4

Ending Streams: Collection and Reduction

Pipelines are ended by terminal operations, which we saw in Chapter 3 are divided into three groups: search operations, reductions, and operations with side-effects. Although we surveyed all three groups then, there is much more to say about reductions; this chapter takes up that story.

Broadly speaking, reductions are operations which return a single value that in some way summarizes the values of the stream elements. But this description does not make a distinction—very important to Java programmers—between summarizing operations that create new objects and those that change their operands. Traditional ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required