mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-24 09:20:53 +07:00
27 lines
1.1 KiB
Java
27 lines
1.1 KiB
Java
import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Stream;
|
|
|
|
import static java.util.stream.Collectors.groupingBy;
|
|
import static java.util.stream.Collectors.mapping;
|
|
|
|
class Test {
|
|
private static Map<Long, Long> multiDataPointsToPerTxnSummedValue(final Stream<Map.Entry<DateTime, Map<Long, Long>>> stream) {
|
|
return stream.flatMap(e -> e.getValue().entrySet().stream().map(ex ->
|
|
new Object() {
|
|
Long txId = ex.getKey();
|
|
DataPoint dataPoint = new DataPoint(e.getKey(), ex.getValue());
|
|
}
|
|
)).collect(groupingBy(t -> t.txId, mapping(t -> t.dataPoint, Collectors.summingLong(dataPoint -> dataPoint.getValue().longValue()))));
|
|
}
|
|
|
|
static class MultiDataPoint {}
|
|
static class DateTime {}
|
|
|
|
static class DataPoint {
|
|
DataPoint(DateTime t, Long val) {}
|
|
public Long getValue() {
|
|
return null;
|
|
}
|
|
}
|
|
} |