-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Step3. 3단계 - 로또(2등) #1125
Step3. 3단계 - 로또(2등) #1125
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이전 단계에서부터 구조를 잘 잡으셔서 큰 변경없이 요구사항을 구현하셨네요! 👍
간단한 피드백 남겼으니 다음 단계에서 함께 반영해주세요!
(oldValue, newValue) -> oldValue, LinkedHashMap::new)); | ||
private List<Prize> awards(LottoTickets userLottoTickets, WinningLottoTicket winnerLottoTicket) { | ||
return userLottoTickets.getLottoTickets().stream() | ||
.map(lottoTicket -> matchTicketToPrize(lottoTicket, winnerLottoTicket)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
필드를 지닌 객체를 통해 로직이 처리되도록 winnerLottoTicket
로 메시지를 보내도록 바꿔보면 어떨까요?
Prize prize = winnerLottoTicket.match(lottoTicket)
return Arrays.stream(values()).filter(prize -> prize.isEqualMatchCount(count)) | ||
.filter(prize -> !prize.equals(SECOND) || isMatchBonus) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stream은 한 줄에 하나의 처리만 하도록 구현하면 가독성을 향상시킬 수 있습니다.
return Arrays.stream(values()).filter(prize -> prize.isEqualMatchCount(count)) | |
.filter(prize -> !prize.equals(SECOND) || isMatchBonus) | |
return Arrays.stream(values()) | |
.filter(prize -> prize.isEqualMatchCount(count)) | |
.filter(prize -> !prize.equals(SECOND) || isMatchBonus) |
No description provided.