Skip to content

Commit

Permalink
Use EnumMap to order players
Browse files Browse the repository at this point in the history
  • Loading branch information
Mw3y committed May 21, 2024
1 parent 4b708a6 commit 5232ef5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ch/epfl/chacun/gui/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private void applyStateAction(ActionEncoder.StateAction stateAction,
*/
private Map<PlayerColor, String> createPlayers(List<String> playerNames) {
List<PlayerColor> playerColors = PlayerColor.ALL.subList(0, playerNames.size());
Map<PlayerColor, String> players = new HashMap<>();
Map<PlayerColor, String> players = new EnumMap<>(PlayerColor.class);
for (int i = 0; i < playerNames.size(); ++i) {
players.put(playerColors.get(i), playerNames.get(i));
}
Expand Down

0 comments on commit 5232ef5

Please sign in to comment.