From 91fd5025c39dbe94e73e7c6c76bc195931827863 Mon Sep 17 00:00:00 2001 From: Arachneee Date: Thu, 25 Jul 2024 16:39:23 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20forEach=20->=20stream=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/server/haengdong/application/ActionService.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/server/src/main/java/server/haengdong/application/ActionService.java b/server/src/main/java/server/haengdong/application/ActionService.java index 0eda074ca..bda638756 100644 --- a/server/src/main/java/server/haengdong/application/ActionService.java +++ b/server/src/main/java/server/haengdong/application/ActionService.java @@ -1,6 +1,5 @@ package server.haengdong.application; -import java.util.ArrayList; import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -31,10 +30,8 @@ public List getMemberBillReports(String token) { MemberBillReport memberBillReport = MemberBillReport.createByActions(billActions, memberActions); - List memberBillReportResponses = new ArrayList<>(); - memberBillReport.getReports().forEach( - (member, price) -> memberBillReportResponses.add(new MemberBillReportAppResponse(member, price)) - ); - return memberBillReportResponses; + return memberBillReport.getReports().entrySet().stream() + .map(entry -> new MemberBillReportAppResponse(entry.getKey(), entry.getValue())) + .toList(); } }