From 2046535620b0b7594034471842086a47342e1f5a Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 8 Aug 2013 02:09:03 +0200 Subject: [PATCH] Add result comparator that sorts by pack names. --- .../java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java index d3821aa..7b6e64f 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java @@ -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 packNameComparator = new Comparator() { + @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; -- 2.7.4