From 3ab2c3dacb41a0ce60169a50c5791b25d179826d Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 26 Jul 2012 09:00:30 +0200 Subject: [PATCH] Add by-name comparator. --- .../net/pterodactylus/demoscenemusic/data/DefaultArtist.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultArtist.java b/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultArtist.java index 7f99a9c..4d359aa 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultArtist.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultArtist.java @@ -18,6 +18,7 @@ package net.pterodactylus.demoscenemusic.data; import java.util.Collection; +import java.util.Comparator; /** * Default implementation for an artist data container. @@ -26,6 +27,15 @@ import java.util.Collection; */ public class DefaultArtist extends DefaultBase implements Artist { + /** Comparator that sorts artists by name. */ + public static final Comparator NAME_COMPARATOR = new Comparator() { + + @Override + public int compare(Artist leftArtist, Artist rightArtist) { + return leftArtist.getName().compareToIgnoreCase(rightArtist.getName()); + } + }; + /** * Creates a new artist data container. * -- 2.7.4