X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FSearchPage.java;h=08b6ccca2bf077f5884a150fe9c067677fab1d02;hb=13e6ab1c63ed982d5be1dd2f436b8af79acd8fd6;hp=355df1bfb7c8ac1fa183b5ba1e31eb7f885fae60;hpb=3c0eab168828267ed7f5c51083babb0f88bd433c;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/SearchPage.java b/src/main/java/net/pterodactylus/sone/web/SearchPage.java index 355df1b..08b6ccc 100644 --- a/src/main/java/net/pterodactylus/sone/web/SearchPage.java +++ b/src/main/java/net/pterodactylus/sone/web/SearchPage.java @@ -50,6 +50,7 @@ import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.collect.Collections2; import com.google.common.collect.FluentIterable; +import com.google.common.collect.Ordering; /** * This page lets the user search for posts and replies that contain certain @@ -138,10 +139,8 @@ public class SearchPage extends SoneTemplatePage { postHits = Collections2.filter(postHits, Hit.POSITIVE_FILTER); /* now sort. */ - List> sortedSoneHits = new ArrayList>(soneHits); - Collections.sort(sortedSoneHits, Hit.DESCENDING_COMPARATOR); - List> sortedPostHits = new ArrayList>(postHits); - Collections.sort(sortedPostHits, Hit.DESCENDING_COMPARATOR); + List> sortedSoneHits = Ordering.from(Hit.DESCENDING_COMPARATOR).sortedCopy(soneHits); + List> sortedPostHits = Ordering.from(Hit.DESCENDING_COMPARATOR).sortedCopy(postHits); /* extract Sones and posts. */ List resultSones = FluentIterable.from(sortedSoneHits).transform(new HitMapper()).toList();