fixed tournament random order at the end

This commit is contained in:
2025-12-28 18:53:14 +01:00
parent 865cdfa605
commit c79fbf3136

View File

@@ -54,18 +54,18 @@ public class Tournament {
}
public List<Set<Player>> getPlaces() {
List<Set<Player>> players = new ArrayList<>(
this.getGameScores().entrySet().stream()
Map<Integer, Set<Player>> players = this.getGameScores().entrySet().stream()
.collect(
Collectors.groupingBy(
Map.Entry::getValue,
Collectors.mapping(Map.Entry::getKey, Collectors.toSet())
)
).values()
);
Collections.reverse(players);
return players;
return players.entrySet().stream()
.sorted(Map.Entry.<Integer, Set<Player>>comparingByKey().reversed())
.map(Map.Entry::getValue)
.toList();
}
private int boost(int selfPlace, int placeCount) {