Commit 3d74a2fb authored by Matteo Melli's avatar Matteo Melli

Merge branch 'fix-empty-groups' into 'master'

Groups should return a value event if no process is active in the group

See merge request ongresinc/pgio!2
parents d6ff6299 9f30c3fd
......@@ -61,11 +61,12 @@ public class ProcessGroupStat {
private Optional<UnsignedLong> reduceFromStats(
Function<ProcessStat, Optional<UnsignedLong>> valueSupplier) {
return stats.stream()
return Optional.of(stats.stream()
.reduce(Optional.<UnsignedLong>empty(),
(result, stat) -> valueSupplier.apply(stat)
.map(value -> result.orElse(UnsignedLong.ZERO).plus(value)),
(u, v) -> v);
(u, v) -> v)
.orElse(UnsignedLong.ZERO));
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment