From: David ‘Bombe’ Roden Date: Thu, 24 Jan 2013 05:10:32 +0000 (+0100) Subject: Merge commit 'fcabe38e9b3abacc0d580bf0513600858aee2eca' into less-critical X-Git-Tag: 0.8.5^2~3^2~58^2~5 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=3b751d0c053450961bb66d2507d6187ce56f8785;p=Sone.git Merge commit 'fcabe38e9b3abacc0d580bf0513600858aee2eca' into less-critical Conflicts: src/main/java/net/pterodactylus/sone/core/Core.java --- 3b751d0c053450961bb66d2507d6187ce56f8785 diff --cc src/main/java/net/pterodactylus/sone/core/Core.java index 4356120,8172b45..f056c0e --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@@ -584,26 -584,21 +587,23 @@@ public class Core extends AbstractServi } /** - * Returns all replies for the given post, order ascending by time. - * - * @param post - * The post to get all replies for - * @return All replies for the given post + * {@inheritDoc} */ + @Override - public List getReplies(Post post) { - Set sones = getSones(); - List replies = new ArrayList(); - for (Sone sone : sones) { - for (PostReply reply : sone.getReplies()) { - if (reply.getPost().equals(post)) { - replies.add(reply); - } + public List getReplies(final Post post) { + return Ordering.from(Reply.TIME_COMPARATOR).sortedCopy(FluentIterable.from(getSones()).transformAndConcat(new Function>() { + + @Override + public Iterable apply(Sone sone) { + return sone.getReplies(); } - } - Collections.sort(replies, Reply.TIME_COMPARATOR); - return replies; + }).filter(new Predicate() { + + @Override + public boolean apply(PostReply reply) { + return post.equals(reply.getPost()); + } + })); } /**