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