mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-25 15:52:06 +01:00
Make Roster.rosterListeners a LinkedHashSet
This commit is contained in:
parent
d5b8647d9d
commit
bb85d2b437
1 changed files with 8 additions and 7 deletions
|
@ -22,6 +22,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -124,7 +125,7 @@ public class Roster extends Manager {
|
||||||
private final Map<String, RosterGroup> groups = new ConcurrentHashMap<String, RosterGroup>();
|
private final Map<String, RosterGroup> groups = new ConcurrentHashMap<String, RosterGroup>();
|
||||||
private final Map<String,RosterEntry> entries = new ConcurrentHashMap<String,RosterEntry>();
|
private final Map<String,RosterEntry> entries = new ConcurrentHashMap<String,RosterEntry>();
|
||||||
private final List<RosterEntry> unfiledEntries = new CopyOnWriteArrayList<RosterEntry>();
|
private final List<RosterEntry> unfiledEntries = new CopyOnWriteArrayList<RosterEntry>();
|
||||||
private final List<RosterListener> rosterListeners = new CopyOnWriteArrayList<RosterListener>();
|
private final Set<RosterListener> rosterListeners = new LinkedHashSet<>();
|
||||||
private final Map<String, Map<String, Presence>> presenceMap = new ConcurrentHashMap<String, Map<String, Presence>>();
|
private final Map<String, Map<String, Presence>> presenceMap = new ConcurrentHashMap<String, Map<String, Presence>>();
|
||||||
|
|
||||||
// The roster is marked as initialized when at least a single roster packet
|
// The roster is marked as initialized when at least a single roster packet
|
||||||
|
@ -338,11 +339,10 @@ public class Roster extends Manager {
|
||||||
* changes to the roster are pushed from the server.
|
* changes to the roster are pushed from the server.
|
||||||
*
|
*
|
||||||
* @param rosterListener a roster listener.
|
* @param rosterListener a roster listener.
|
||||||
|
* @return true if the listener was not already added.
|
||||||
*/
|
*/
|
||||||
public void addRosterListener(RosterListener rosterListener) {
|
public boolean addRosterListener(RosterListener rosterListener) {
|
||||||
if (!rosterListeners.contains(rosterListener)) {
|
return rosterListeners.add(rosterListener);
|
||||||
rosterListeners.add(rosterListener);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -350,9 +350,10 @@ public class Roster extends Manager {
|
||||||
* changes to the roster are pushed from the server.
|
* changes to the roster are pushed from the server.
|
||||||
*
|
*
|
||||||
* @param rosterListener a roster listener.
|
* @param rosterListener a roster listener.
|
||||||
|
* @return true if the listener was active and got removed.
|
||||||
*/
|
*/
|
||||||
public void removeRosterListener(RosterListener rosterListener) {
|
public boolean removeRosterListener(RosterListener rosterListener) {
|
||||||
rosterListeners.remove(rosterListener);
|
return rosterListeners.remove(rosterListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue