Skip to content

Commit

Permalink
refactor: forEach -> stream λ³€κ²½
Browse files Browse the repository at this point in the history
  • Loading branch information
Arachneee committed Jul 25, 2024
1 parent 8b3a0a3 commit 91fd502
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package server.haengdong.application;

import java.util.ArrayList;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -31,10 +30,8 @@ public List<MemberBillReportAppResponse> getMemberBillReports(String token) {

MemberBillReport memberBillReport = MemberBillReport.createByActions(billActions, memberActions);

List<MemberBillReportAppResponse> 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();
}
}

0 comments on commit 91fd502

Please sign in to comment.