From 40e866b397b00588c0e4a4388dbfe670d1746680 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 2 Nov 2010 06:31:56 +0100 Subject: [PATCH] Use the pre-made Sone comparator. --- .../java/net/pterodactylus/sone/web/KnownSonesPage.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java b/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java index ff434b3..52b7273 100644 --- a/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java +++ b/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java @@ -19,11 +19,9 @@ package net.pterodactylus.sone.web; import java.util.ArrayList; import java.util.Collections; -import java.util.Comparator; import java.util.List; import net.pterodactylus.sone.data.Sone; -import net.pterodactylus.sone.template.SoneAccessor; import net.pterodactylus.util.template.Template; /** @@ -56,18 +54,7 @@ public class KnownSonesPage extends SoneTemplatePage { protected void processTemplate(Request request, Template template) throws RedirectException { super.processTemplate(request, template); List knownSones = new ArrayList(webInterface.core().getSones()); - Collections.sort(knownSones, new Comparator() { - - @Override - public int compare(Sone leftSone, Sone rightSone) { - int diff = SoneAccessor.getNiceName(leftSone).compareToIgnoreCase(SoneAccessor.getNiceName(rightSone)); - if (diff != 0) { - return diff; - } - return (int) Math.max(Integer.MIN_VALUE, Math.min(Integer.MAX_VALUE, rightSone.getTime() - leftSone.getTime())); - } - - }); + Collections.sort(knownSones, Sone.NICE_NAME_COMPARATOR); template.set("knownSones", knownSones); } -- 2.7.4