Skip to content

Commit

Permalink
Merge pull request #439 from mash-up-kr/fix/mashong-get-next-mission-…
Browse files Browse the repository at this point in the history
…level

MashongMission에서 다음 미션 레벨 얻어올 때 없으면 null이 아니라 max 값을 반환하게 수정
  • Loading branch information
eunjungL authored Jun 29, 2024
2 parents 9d09c17 + c951f12 commit 84a1964
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ public MashongMissionLevel getFirstMissionLevel() {

public MashongMissionLevel getNextMissionLevel(Long level) {
return mashongMissionLevelList.stream()
.filter(missionLevel -> missionLevel.getLevel() == level + 1)
.findFirst()
.orElseGet(null);
.filter(missionLevel -> missionLevel.getLevel() == level + 1)
.findFirst()
.orElseGet(() -> mashongMissionLevelList.stream()
.max(Comparator.comparing(MashongMissionLevel::getLevel))
.orElseThrow(IllegalStateException::new)
);
}
}

0 comments on commit 84a1964

Please sign in to comment.