partitioningBy를 사용한 쪼개기 분할하기

라헬·2022년 12월 24일
0

Map<Boolean, Dish> mostCaloricPartitionedByVegetarian =
menu.stream().collect(
partitioningBy(Dish::isVegetarian,
collectingAndThen(maxBy(comparingInt(Dish::getCalories)),
Optional::get)));

결과는 {false=pork, true=pizza}

profile
성장하고 싶은 풀스택 개발자

0개의 댓글