LongSummaryStatistics 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 ints use IntSummaryStatistics or doubles use DoubleSummaryStatistics.
Compute summary statistics on a stream
LongSummaryStatistics as a reduction target