So basically my program looks like this:
Map<Month, List<Purchase>> map2 = purchases
.stream()
.collect(Collectors.groupingBy(Purchase::getMonthOfDate));
which creates Map containing the Month and a list of Purchases as values (each Purchase contains a Price).
My goal is getting a Map that looks like this:
Map<Month, Double>
where Month stays the same as the old map but all prices of the Purchases for each month get summed up and put in as double.
Is there any way to achieve that?