Improve performance of "AggregationServiceImpl.createYearMap()".

This commit is contained in:
Lampros Smyrnaios 2022-12-14 17:12:27 +02:00
parent a40c1b3e44
commit 63c9caaf96
1 changed files with 1 additions and 4 deletions

View File

@ -81,11 +81,8 @@ public class AggregationServiceImpl implements AggregationService {
private Map<String, List<AggregationInfo>> createYearMap(List<AggregationInfo> aggregationHistory) {
aggregationHistory = aggregationHistory.stream()
.sorted(Comparator.comparing(AggregationInfo::getDate).reversed())
.collect(Collectors.toList());
return aggregationHistory.stream()
.sorted(Comparator.comparing(AggregationInfo::getDate).reversed())
.collect(Collectors.groupingBy(item -> getYear(item.getDate())));
}