[Java] 다중 조건 정렬

Hye·2022년 12월 26일
0

🔎 thenComparing()

  • Stream 요소를 기본 정렬할 때는 sorted()를 사용
  • 정렬할 때 기준을 추가하고 싶은 경우에 사용
  • 역순으로 정렬하고 싶은 경우에는 reversed() 사용
stream().sorted(기준1)
	  .thenComparing(기준2.reversed());
profile
공부중 📚

0개의 댓글

관련 채용 정보