X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftemplate%2FReplyGroupFilter.java;h=6ea65505115f3839c54c0938875e1df816afb508;hp=76ca103dcbdacfd2a386250e42f4ee41d63daa6b;hb=62573c314957b1851f4fbe693b8746686caa940a;hpb=d766553c0918f2522e8d6314b7dc3aca6f78eb7d diff --git a/src/main/java/net/pterodactylus/sone/template/ReplyGroupFilter.java b/src/main/java/net/pterodactylus/sone/template/ReplyGroupFilter.java index 76ca103..6ea6550 100644 --- a/src/main/java/net/pterodactylus/sone/template/ReplyGroupFilter.java +++ b/src/main/java/net/pterodactylus/sone/template/ReplyGroupFilter.java @@ -30,14 +30,10 @@ import net.pterodactylus.sone.data.Sone; import net.pterodactylus.util.template.Filter; import net.pterodactylus.util.template.TemplateContext; -import com.google.common.base.Optional; - /** * {@link Filter} implementation that groups replies by the post the are in * reply to, returning a map with the post as key and the list of replies as * values. - * - * @author David ‘Bombe’ Roden */ public class ReplyGroupFilter implements Filter { @@ -55,25 +51,22 @@ public class ReplyGroupFilter implements Filter { * All replies from a new-reply notification have posts, * ListNotificationFilters takes care of that. */ - Optional post = reply.getPost(); - Set sones = postSones.get(post.get()); + Post post = reply.getPost().get(); + Set sones = postSones.get(post); if (sones == null) { sones = new HashSet<>(); - postSones.put(post.get(), sones); + postSones.put(post, sones); } sones.add(reply.getSone()); - Set replies = postReplies.get(post.get()); + Set replies = postReplies.get(post); if (replies == null) { replies = new HashSet<>(); - postReplies.put(post.get(), replies); + postReplies.put(post, replies); } replies.add(reply); } Map>> result = new HashMap<>(); for (Entry> postEntry : postSones.entrySet()) { - if (result.containsKey(postEntry.getKey())) { - continue; - } Map> postResult = new HashMap<>(); postResult.put("sones", postEntry.getValue()); postResult.put("replies", postReplies.get(postEntry.getKey()));