From: David ‘Bombe’ Roden Date: Mon, 21 Nov 2011 17:52:53 +0000 (+0100) Subject: Add album title comparator. X-Git-Tag: 0.7.4^2~3 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=9c67e1db61cfe1048769562d12291ddf8333ad88;p=Sone.git Add album title comparator. --- diff --git a/src/main/java/net/pterodactylus/sone/data/Album.java b/src/main/java/net/pterodactylus/sone/data/Album.java index b15bc00..0bdf3a9 100644 --- a/src/main/java/net/pterodactylus/sone/data/Album.java +++ b/src/main/java/net/pterodactylus/sone/data/Album.java @@ -18,6 +18,7 @@ package net.pterodactylus.sone.data; import java.util.ArrayList; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -35,6 +36,15 @@ import net.pterodactylus.util.validation.Validation; */ public class Album implements Fingerprintable { + /** Compares two {@link Album}s by {@link #getTitle()}. */ + public static final Comparator TITLE_COMPARATOR = new Comparator() { + + @Override + public int compare(Album leftAlbum, Album rightAlbum) { + return leftAlbum.getTitle().compareToIgnoreCase(rightAlbum.getTitle()); + } + }; + /** The ID of this album. */ private final String id;