Averaging

How about computing the average weight of a melon?

For this, we have Collectors.averagingInt(), averagingLong(), and averagingDouble():

double avgWeights = melons.stream()
.collect(Collectors.averagingInt(Melon::getWeight));
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset