From: David ‘Bombe’ Roden Date: Tue, 17 Sep 2013 13:20:38 +0000 (+0200) Subject: Iterate over the entries instead of only the keys. X-Git-Tag: 0.8.7^2~12 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=eaf22ebf7d6ab8ca1d0a3222736e94ee6d4a7da8;p=Sone.git Iterate over the entries instead of only the keys. --- diff --git a/src/main/java/net/pterodactylus/sone/template/ReplyGroupFilter.java b/src/main/java/net/pterodactylus/sone/template/ReplyGroupFilter.java index bcf73d8..3d5fda1 100644 --- a/src/main/java/net/pterodactylus/sone/template/ReplyGroupFilter.java +++ b/src/main/java/net/pterodactylus/sone/template/ReplyGroupFilter.java @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import net.pterodactylus.sone.data.Post; @@ -69,14 +70,14 @@ public class ReplyGroupFilter implements Filter { replies.add(reply); } Map>> result = new HashMap>>(); - for (Post post : postSones.keySet()) { - if (result.containsKey(post)) { + for (Entry> postEntry : postSones.entrySet()) { + if (result.containsKey(postEntry.getKey())) { continue; } Map> postResult = new HashMap>(); - postResult.put("sones", postSones.get(post)); - postResult.put("replies", postReplies.get(post)); - result.put(post, postResult); + postResult.put("sones", postEntry.getValue()); + postResult.put("replies", postReplies.get(postEntry.getKey())); + result.put(postEntry.getKey(), postResult); } return result; }