SortedMap<LocalDate, EffortDuration> result = new TreeMap<LocalDate, EffortDuration>();
for (Entry<LocalDate, EffortDuration> each : map.entrySet()) {
LocalDate centerOfWeek = getThursdayOfThisWeek(each.getKey());
EffortDuration accumulated = result.get(centerOfWeek);
accumulated = accumulated == null ? zero() : accumulated;
result.put(centerOfWeek, accumulated.plus(each.getValue()));
}
return result;
}
private static SortedMap<LocalDate, EffortDuration> average(