Use Sone comparator.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 5 Nov 2010 22:42:17 +0000 (23:42 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 5 Nov 2010 22:42:17 +0000 (23:42 +0100)
src/main/java/net/pterodactylus/sone/data/Sone.java

index fd69832..145dca4 100644 (file)
@@ -291,17 +291,7 @@ public class Sone {
         */
        public List<Sone> getFriends() {
                List<Sone> friends = new ArrayList<Sone>(friendSones);
-               Collections.sort(friends, new Comparator<Sone>() {
-
-                       @Override
-                       public int compare(Sone leftSone, Sone rightSone) {
-                               int diff = SoneAccessor.getNiceName(leftSone).compareToIgnoreCase(SoneAccessor.getNiceName(rightSone));
-                               if (diff != 0) {
-                                       return diff;
-                               }
-                               return (int) Math.max(Integer.MIN_VALUE, Math.min(Integer.MAX_VALUE, rightSone.getTime() - leftSone.getTime()));
-                       }
-               });
+               Collections.sort(friends, NICE_NAME_COMPARATOR);
                return friends;
        }