Friday, 9 August 2013

ArrayList - get the highest int value?

ArrayList - get the highest int value?

private static void theEnd() {
Map<Client, Integer> Score = new HashMap<Client, Integer>();
for (Client player : getPlayers()) {
Client c = (Client) player;
Score.add(c, c.gameScore);
}
}
Basically, it loops through all clients, and adds their game score into my
new Map Score. Now, I have the arraylist ready with values, and I want to
assign a winner in the game.
To be a winner, you must have the highest score.
My question:
How can I find the highest game score in the map collection?

No comments:

Post a Comment