Skip to content

Commit 29b9ddc

Browse files
authored
Update ScoreTracker.java
1 parent 7fa964b commit 29b9ddc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tic_tac_toe/tictactoe/ScoreTracker.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ public void reportGameResult(Player player1, Player player2, Optional<Player> wi
2222
}
2323
}
2424

25-
// Returns a map of players sorted by their ratings in descending order
26-
public Map<Player, Integer> getTopPlayers() {
25+
// Returns a list of players sorted by their ratings in descending order
26+
public List<Player> getTopPlayers() {
2727
return playerRatings.entrySet()
2828
.stream()
2929
.sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))
3030
.map(Map.Entry::getKey)
31-
.collect(Collectors.toMap(player -> player, player -> playerRatings.get(player)));
31+
.collect(Collectors.toList());
3232
}
3333

3434
// Returns the rank of a player (1-based) based on their rating

0 commit comments

Comments
 (0)