X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2Fimpl%2FSoneImpl.java;h=f2f2ea620ba161af8a45e924ea1b0539a2cd9c1f;hp=093b038f9a776d7eab018dddd35eebfa7e282787;hb=64740709990291688170ebd1f192af5eb9090618;hpb=7be5373f355b3184e02a61b39238a89be177c040 diff --git a/src/main/java/net/pterodactylus/sone/data/impl/SoneImpl.java b/src/main/java/net/pterodactylus/sone/data/impl/SoneImpl.java index 093b038..f2f2ea6 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/SoneImpl.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/SoneImpl.java @@ -21,6 +21,8 @@ import static com.google.common.base.Preconditions.checkNotNull; import static java.lang.String.format; import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.logging.Logger.getLogger; +import static net.pterodactylus.sone.data.PostKt.newestPostFirst; +import static net.pterodactylus.sone.data.ReplyKt.newestReplyFirst; import static net.pterodactylus.sone.data.SoneKt.*; import java.net.MalformedURLException; @@ -37,11 +39,11 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import net.pterodactylus.sone.data.Album; +import net.pterodactylus.sone.data.AlbumKt; import net.pterodactylus.sone.data.Client; import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.PostReply; import net.pterodactylus.sone.data.Profile; -import net.pterodactylus.sone.data.Reply; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.data.SoneOptions; import net.pterodactylus.sone.data.SoneOptions.DefaultSoneOptions; @@ -364,7 +366,7 @@ public class SoneImpl implements Sone { synchronized (this) { sortedPosts = new ArrayList<>(posts); } - Collections.sort(sortedPosts, Post.NEWEST_FIRST); + sortedPosts.sort(newestPostFirst()); return sortedPosts; } @@ -624,7 +626,7 @@ public class SoneImpl implements Sone { hash.putString(")", UTF_8); List replies = new ArrayList<>(getReplies()); - Collections.sort(replies, Reply.TIME_COMPARATOR); + replies.sort(newestReplyFirst().reversed()); hash.putString("Replies(", UTF_8); for (PostReply reply : replies) { hash.putString("Reply(", UTF_8).putString(reply.getId(), UTF_8).putString(")", UTF_8); @@ -649,7 +651,7 @@ public class SoneImpl implements Sone { hash.putString("Albums(", UTF_8); for (Album album : rootAlbum.getAlbums()) { - if (!Album.NOT_EMPTY.apply(album)) { + if (!AlbumKt.notEmpty().invoke(album)) { continue; } hash.putString(album.getFingerprint(), UTF_8);