Skip to content

Commit

Permalink
fix: Map value에 항상 새로운 List 들어가던 오류 수정(#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
eun-seong committed Mar 6, 2024
1 parent b7b75b4 commit 2cd1145
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -47,8 +48,8 @@ public Map<DashboardType, List<Statistic>> mapStatisticsByDashboardType() {
Map<DashboardType, List<Statistic>> statistics = new HashMap<>();
this.statistics.values().forEach(statistic -> {
DashboardType dashboardType = statistic.getDashboardType();
statistics.putIfAbsent(dashboardType, List.of());
statistics.put(dashboardType, List.of(statistic));
statistics.putIfAbsent(dashboardType, new ArrayList<>());
statistics.get(dashboardType).add(statistic);
});

return statistics;
Expand Down

0 comments on commit 2cd1145

Please sign in to comment.