/** * Returns an unmodifiable collection of all entries in the roster, including entries * that don't belong to any groups. * * @return all entries in the roster. */ public Collection<RosterEntry> getEntries() { Set<RosterEntry> allEntries = new HashSet<RosterEntry>(); // Loop through all roster groups and add their entries to the answer for (RosterGroup rosterGroup : getGroups()) { allEntries.addAll(rosterGroup.getEntries()); } // Add the roster unfiled entries to the answer allEntries.addAll(unfiledEntries); return Collections.unmodifiableCollection(allEntries); }
/** * Returns an unmodifiable collection of the roster groups that this entry belongs to. * * @return an iterator for the groups this entry belongs to. */ public Collection<RosterGroup> getGroups() { List<RosterGroup> results = new ArrayList<RosterGroup>(); // Loop through all roster groups and find the ones that contain this // entry. This algorithm should be fine for (RosterGroup group: roster.getGroups()) { if (group.contains(this)) { results.add(group); } } return Collections.unmodifiableCollection(results); }
/** * Returns an unmodifiable collection of all entries in the roster, including entries * that don't belong to any groups. * * @return all entries in the roster. */ public Collection<RosterEntry> getEntries() { Set<RosterEntry> allEntries = new HashSet<RosterEntry>(); // Loop through all roster groups and add their entries to the answer for (RosterGroup rosterGroup : getGroups()) { allEntries.addAll(rosterGroup.getEntries()); } // Add the roster unfiled entries to the answer allEntries.addAll(unfiledEntries); return Collections.unmodifiableCollection(allEntries); }
/** * Returns an unmodifiable collection of the roster groups that this entry belongs to. * * @return an iterator for the groups this entry belongs to. */ public Collection<RosterGroup> getGroups() { List<RosterGroup> results = new ArrayList<RosterGroup>(); // Loop through all roster groups and find the ones that contain this // entry. This algorithm should be fine for (RosterGroup group: roster.getGroups()) { if (group.contains(this)) { results.add(group); } } return Collections.unmodifiableCollection(results); }
/** * Returns an unmodifiable collection of the roster groups that this entry belongs to. * * @return an iterator for the groups this entry belongs to. */ public Collection<RosterGroup> getGroups() { List<RosterGroup> results = new ArrayList<RosterGroup>(); // Loop through all roster groups and find the ones that contain this // entry. This algorithm should be fine for (RosterGroup group: roster.getGroups()) { if (group.contains(this)) { results.add(group); } } return Collections.unmodifiableCollection(results); }
/** * Returns an unmodifiable collection of all entries in the roster, including entries * that don't belong to any groups. * * @return all entries in the roster. */ public Collection<RosterEntry> getEntries() { Set<RosterEntry> allEntries = new HashSet<RosterEntry>(); // Loop through all roster groups and add their entries to the answer for (RosterGroup rosterGroup : getGroups()) { allEntries.addAll(rosterGroup.getEntries()); } // Add the roster unfiled entries to the answer allEntries.addAll(unfiledEntries); return Collections.unmodifiableCollection(allEntries); }
/** * Returns an iterator for all the roster groups that this entry belongs to. * * @return an iterator for the groups this entry belongs to. */ public Iterator getGroups() { List results = new ArrayList(); // Loop through all roster groups and find the ones that contain this // entry. This algorithm should be fine for (Iterator i=connection.roster.getGroups(); i.hasNext(); ) { RosterGroup group = (RosterGroup)i.next(); if (group.contains(this)) { results.add(group); } } return results.iterator(); }
/** * Get a list of all your FriendGroups. * * @return A List of all your FriendGroups */ public List<FriendGroup> getFriendGroups() { final ArrayList<FriendGroup> groups = new ArrayList<>(); for (final RosterGroup g : connection.getRoster().getGroups()) { groups.add(new FriendGroup(this, connection, g)); } return groups; }
/** * Returns a count of the entries in the roster. * * @return the number of entries in the roster. */ public int getEntryCount() { HashMap entryMap = new HashMap(); // Loop through all roster groups. for (Iterator groups = getGroups(); groups.hasNext(); ) { RosterGroup rosterGroup = (RosterGroup) groups.next(); for (Iterator entries = rosterGroup.getEntries(); entries.hasNext(); ) { entryMap.put(entries.next(), ""); } } synchronized (unfiledEntries) { return entryMap.size() + unfiledEntries.size(); } }
/** * 获取当前登录用户的所有分组 */ public ArrayList<RosterGroup> getGroups() { Roster roster = getXmppConnection().getRoster(); return new ArrayList<>(roster.getGroups()); }
/** * Returns all entries in the roster, including entries that don't belong to * any groups. * * @return all entries in the roster. */ public Iterator getEntries() { ArrayList allEntries = new ArrayList(); // Loop through all roster groups and add their entries to the answer for (Iterator groups = getGroups(); groups.hasNext(); ) { RosterGroup rosterGroup = (RosterGroup) groups.next(); for (Iterator entries = rosterGroup.getEntries(); entries.hasNext(); ) { RosterEntry entry = (RosterEntry)entries.next(); if (!allEntries.contains(entry)) { allEntries.add(entry); } } } // Add the roster unfiled entries to the answer synchronized (unfiledEntries) { allEntries.addAll(unfiledEntries); } return allEntries.iterator(); }
for (Iterator it = getGroups(); it.hasNext();) { RosterGroup group = (RosterGroup)it.next(); if (group.getEntryCount() == 0) {