Performing Stream Operations with a Single Pass of a Sequential Stream

Lines 39–48 demonstrate the performance improvement you get by using LongStream method summaryStatistics to determine the count, sum, minimum value, maximum value and average in one pass of a sequential LongStream—all streams are sequential by default. This operation took approximately 40% of the time required to perform the five operations separately.

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.