/** * Adds a roster entry to the packet. * * @param rosterEntry a roster entry to add. */ public void addRosterEntry(RosterEntry rosterEntry) { // Obtain a String[] from the roster entry groups name List<String> groupNamesList = new ArrayList<String>(); String[] groupNames; for (RosterGroup group : rosterEntry.getGroups()) { groupNamesList.add(group.getName()); } groupNames = groupNamesList.toArray(new String[groupNamesList.size()]); // Create a new Entry based on the rosterEntry and add it to the packet RemoteRosterEntry remoteRosterEntry = new RemoteRosterEntry(rosterEntry.getUser(), rosterEntry.getName(), groupNames); addRosterEntry(remoteRosterEntry); }
/** * Adds a roster entry to the packet. * * @param rosterEntry * a roster entry to add. */ public void addRosterEntry(RosterEntry rosterEntry) { // Obtain a String[] from the roster entry groups name List<String> groupNamesList = new ArrayList<String>(); String[] groupNames; for (RosterGroup group : rosterEntry.getGroups()) { groupNamesList.add(group.getName()); } groupNames = groupNamesList.toArray(new String[groupNamesList.size()]); // Create a new Entry based on the rosterEntry and add it to the packet RemoteRosterEntry remoteRosterEntry = new RemoteRosterEntry( rosterEntry.getUser(), rosterEntry.getName(), groupNames); addRosterEntry(remoteRosterEntry); }
/** * Returns an Iterator for the roster entries in the packet. * * @return an Iterator for the roster entries in the packet. */ public Iterator<RemoteRosterEntry> getRosterEntries() { synchronized (remoteRosterEntries) { List<RemoteRosterEntry> entries = Collections.unmodifiableList(new ArrayList<RemoteRosterEntry>(remoteRosterEntries)); return entries.iterator(); } }
/** * Adds a remote roster entry to the packet. * * @param remoteRosterEntry a remote roster entry to add. */ public void addRosterEntry(RemoteRosterEntry remoteRosterEntry) { synchronized (remoteRosterEntries) { remoteRosterEntries.add(remoteRosterEntry); } }
/** * Adds a remote roster entry to the packet. * * @param remoteRosterEntry * a remote roster entry to add. */ public void addRosterEntry(RemoteRosterEntry remoteRosterEntry) { synchronized (remoteRosterEntries) { remoteRosterEntries.add(remoteRosterEntry); } }