Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void sortList(List<players> players) {
- Collections.sort(players, new Comparator<Object>() {
- public int compare(Object o1, Object o2) {
- Integer firstScore = ((players) o1).getScore();
- Integer secondScore = ((players) o2).getScore();
- int comparedValue = firstScore.compareTo(secondScore);
- if (comparedValue != 0) {
- return comparedValue;
- }
- else {
- Double timeOne = ((players) o1).getTime();
- Double timeTwo = ((players) o2).getTime();
- return timeOne.compareTo(timeTwo);
- }
- }
- }
- );
- }
Add Comment
Please, Sign In to add comment