From: David ‘Bombe’ Roden Date: Fri, 30 Sep 2011 12:56:55 +0000 (+0200) Subject: Add Sone comparator by image count. X-Git-Tag: 0.7.2^2~7 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=2b6349abcc3380869532b4fab01f7cff9d3c2ac3;p=Sone.git Add Sone comparator by image count. --- 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() {