From 2b6349abcc3380869532b4fab01f7cff9d3c2ac3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 30 Sep 2011 14:56:55 +0200 Subject: [PATCH] Add Sone comparator by image count. --- src/main/java/net/pterodactylus/sone/data/Sone.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/data/Sone.java b/src/main/java/net/pterodactylus/sone/data/Sone.java index 1db47c2..ca970c2 100644 --- a/src/main/java/net/pterodactylus/sone/data/Sone.java +++ b/src/main/java/net/pterodactylus/sone/data/Sone.java @@ -84,6 +84,18 @@ public class Sone implements Fingerprintable, Comparable { } }; + /** Comparator that sorts Sones by number of images (descending). */ + public static final Comparator IMAGE_COUNT_COMPARATOR = new Comparator() { + + /** + * {@inheritDoc} + */ + @Override + public int compare(Sone leftSone, Sone rightSone) { + return rightSone.getAllImages().size() - leftSone.getAllImages().size(); + } + }; + /** Filter to remove Sones that have not been downloaded. */ public static final Filter EMPTY_SONE_FILTER = new Filter() { -- 2.7.4