From: David ‘Bombe’ Roden Date: Thu, 8 Aug 2013 00:09:03 +0000 (+0200) Subject: Add result comparator that sorts by pack names. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=2046535620b0b7594034471842086a47342e1f5a;p=xudocci.git Add result comparator that sorts by pack names. --- 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;