更新时间:2023-02-04 08:48:25
您可以先收集到TreeMap
,仅获取最后一个条目(最大值为
You could collect to a TreeMap
first and only get the last entry (where the max is)
players.stream()
.collect(Collectors.groupingBy(
Player::getPoints,
TreeMap::new,
Collectors.toList()
))
.lastEntry()
.getValue();