Skip to content

Commit

Permalink
Merge pull request #238 from depromeet/fix/nullish-sort
Browse files Browse the repository at this point in the history
fix: nullable 객체 정렬 코드 변경
  • Loading branch information
raymondanythings committed Sep 12, 2024
2 parents 9622925 + 970944a commit 0295259
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ public SpaceActionItemGetResponse getSpaceRecentActionItems(Long memberId, Long
// 종료된 것 중 가장 최근에 만들어진 회고 찾기
Optional<Retrospect> recentOpt = retrospectList.stream()
.filter(r -> r.getRetrospectStatus().equals(DONE)) // 끝난 회고 찾기
.sorted((a, b) -> b.getDeadline().compareTo(a.getDeadline())) // deadline 내림차순으로 정렬
.sorted(Comparator.comparing(Retrospect::getDeadline,
Comparator.nullsLast(Comparator.naturalOrder())).reversed()) // deadline 내림차순, null은 아래로 정렬
.findFirst();

if (recentOpt.isPresent()) {
Expand Down

0 comments on commit 0295259

Please sign in to comment.