From 0581580831c46a992e02783e1a832ad886396ace Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 22 Jan 2015 23:57:14 +0100 Subject: [PATCH] Make Roster.unfiledEntries a CopyOnWriteArraySet --- .../java/org/jivesoftware/smack/roster/Roster.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java index f64751a13..4412b27cd 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java @@ -30,7 +30,7 @@ import java.util.Map.Entry; import java.util.Set; import java.util.WeakHashMap; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.CopyOnWriteArraySet; import java.util.logging.Level; import java.util.logging.Logger; @@ -124,7 +124,7 @@ public class Roster extends Manager { private RosterStore rosterStore; private final Map groups = new ConcurrentHashMap(); private final Map entries = new ConcurrentHashMap(); - private final List unfiledEntries = new CopyOnWriteArrayList(); + private final Set unfiledEntries = new CopyOnWriteArraySet<>(); private final Set rosterListeners = new LinkedHashSet<>(); private final Map> presenceMap = new ConcurrentHashMap>(); @@ -496,13 +496,13 @@ public class Roster extends Manager { } /** - * Returns an unmodifiable collection for the unfiled roster entries. An unfiled entry is + * Returns an unmodifiable set for the unfiled roster entries. An unfiled entry is * an entry that doesn't belong to any groups. * * @return the unfiled roster entries. */ - public List getUnfiledEntries() { - return Collections.unmodifiableList(unfiledEntries); + public Set getUnfiledEntries() { + return Collections.unmodifiableSet(unfiledEntries); } /** @@ -924,7 +924,6 @@ public class Roster extends Manager { // Mark the entry as unfiled if it does not belong to any groups. if (item.getGroupNames().isEmpty()) { - unfiledEntries.remove(entry); unfiledEntries.add(entry); } else {