From: David ‘Bombe’ Roden Date: Tue, 31 Jul 2012 05:08:10 +0000 (+0200) Subject: Add comparator for groups. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=c97e15ac89a28b4d632d893c0b3c49a3a3b6d2a6;p=demoscenemusic.git Add comparator for groups. --- diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultGroup.java b/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultGroup.java index 407a425..57cbf40 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultGroup.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultGroup.java @@ -18,6 +18,7 @@ package net.pterodactylus.demoscenemusic.data; import java.util.Collection; +import java.util.Comparator; /** * Default implementation of a group data container. @@ -26,6 +27,16 @@ import java.util.Collection; */ public class DefaultGroup extends DefaultBase implements Group { + /** Comparator that sorts groups by name. */ + public static final Comparator NAME_COMPARATOR = new Comparator() { + + @Override + public int compare(Group leftGroup, Group rightGroup) { + return leftGroup.getName().compareToIgnoreCase(rightGroup.getName()); + } + + }; + /** * Creates a new group data container. *