I've a stream of MetricGroup, where:
public class MetricGroup { private int uploadedDocs; private long uploadedKbs; // getters and setters } I need to sumarize all metrics in one single metric. I mean, I need to add all metric.uploadedDocs into a sumMetric.uploadedDocs and metric.uploadedKds into a sumMetric.uploadedKbs.
I figure out I need some kind of reduce
Stream.of(new MetricGroup(1,100), new MetricGroup(1,200)) .reduce(????); Any ideas?