Section 17.3.3 Terminal Operation reduce

• You can define your own reductions for an IntStream by calling its reduce method. The first argument is a value that helps you begin the reduction operation and the second argument is an object that implements the IntBinaryOperator (p. 740) functional interface.

• Method reduce’s first argument is formally called an identity value (p. 740)—a value that, when combined with any stream element using the IntBinaryOperator produces that element’s original value.

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.