From eaf22ebf7d6ab8ca1d0a3222736e94ee6d4a7da8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 17 Sep 2013 15:20:38 +0200 Subject: [PATCH] Iterate over the entries instead of only the keys. --- .../net/pterodactylus/sone/template/ReplyGroupFilter.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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; } -- 2.7.4