List<Bot> sort(final Map<Bot, Integer> scores) {
List<Bot> bots = new ArrayList<Bot>(scores.keySet());
Collections.sort(bots, new Comparator<Bot>() {
public int compare(Bot a, Bot b) {
// Sorts ASC; to sort DESC negate the value or swap a and b
return scores.get(a).compareTo(scores.get(b));
}
});
return bots;
}