DoubleSummaryStatistics is an object for collecting statistics such as count, min, max, sum, and average. Although not required, it is designed to work with streams. If you are working with longs use LongSummaryStatistics or ints use IntSummaryStatistics .
Compute summary statistics on a stream
DoubleSummaryStatistics as a reduction target