Add result comparator that sorts by pack names.
[xudocci.git] / 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;