1 package net.sourceforge.queried; 2 3 import java.util.Comparator; 4 5 public class ScoreComparator implements Comparator { 6 7 public ScoreComparator() { 8 } 9 10 public int compare(Object obj1, Object obj2) { 11 PlayerInfo playerInfo1 = (PlayerInfo) obj1; 12 PlayerInfo playerInfo2 = (PlayerInfo) obj2; 13 14 if(playerInfo1.getScore() < playerInfo2.getScore()) { 15 return 1; 16 } 17 18 return playerInfo1.getScore() <= playerInfo2.getScore() ? 0 : -1; 19 } 20 }