Add result comparator that sorts by pack names.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 8 Aug 2013 00:09:03 +0000 (02:09 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 8 Aug 2013 00:15:59 +0000 (02:15 +0200)
src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java

index d3821aa..7b6e64f 100644 (file)
@@ -381,6 +381,17 @@ public class CommandReader extends AbstractExecutionThreadService {
                        }
                };
 
+               /**
+                * {@link Comparator} for {@link Result}s that sorts them by the name of the
+                * {@link Pack}.
+                */
+               private static final Comparator<Result> packNameComparator = new Comparator<Result>() {
+                       @Override
+                       public int compare(Result leftResult, Result rightResult) {
+                               return leftResult.pack().name().compareToIgnoreCase(rightResult.pack().name());
+                       }
+               };
+
                /** The bot carrying the pack. */
                private final Bot bot;