1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-01 01:35:59 +01:00

Return List instead of Collection where appropriate

This commit is contained in:
Florian Schmaus 2014-04-14 14:09:53 +02:00
parent 61fd3c9dd0
commit 0136c3eb81
4 changed files with 15 additions and 18 deletions

View file

@ -576,18 +576,18 @@ public class Roster {
}
/**
* Returns an iterator (of Presence objects) for all of a user's current presences
* Returns a List of Presence objects for all of a user's current presences
* or an unavailable presence if the user is unavailable (offline) or if no presence
* information is available, such as when you are not subscribed to the user's presence
* updates.
*
* @param user a XMPP ID, e.g. jdoe@example.com.
* @return an Collection (of Presence objects) for all the user's current presences,
* @return a List of Presence objects for all the user's current presences,
* or an unavailable presence if the user is offline or if no presence information
* is available.
*/
public Collection<Presence> getPresences(String user) {
Collection<Presence> res;
public List<Presence> getPresences(String user) {
List<Presence> res;
String key = getPresenceMapKey(user);
Map<String, Presence> userPresences = presenceMap.get(key);
if (userPresences == null) {
@ -596,7 +596,7 @@ public class Roster {
res = Arrays.asList(presence);
}
else {
Collection<Presence> answer = new ArrayList<Presence>();
List<Presence> answer = new ArrayList<Presence>();
for (Presence presence : userPresences.values()) {
if (presence.isAvailable()) {
answer.add(presence);
@ -611,7 +611,7 @@ public class Roster {
res = Arrays.asList(presence);
}
}
return Collections.unmodifiableCollection(res);
return Collections.unmodifiableList(res);
}
/**

View file

@ -17,7 +17,6 @@
package org.jivesoftware.smackx.muc.packet;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@ -36,13 +35,13 @@ public class MUCAdmin extends IQ {
private List<Item> items = new ArrayList<Item>();
/**
* Returns a Collection of item childs that holds information about roles, affiliation,
* Returns a List of item childs that holds information about roles, affiliation,
* jids and nicks.
*
* @return a Collection of item childs that holds information about roles, affiliation,
* @return a List of item childs that holds information about roles, affiliation,
* jids and nicks.
*/
public Collection<Item> getItems() {
public List<Item> getItems() {
synchronized (items) {
return Collections.unmodifiableList(new ArrayList<Item>(items));
}

View file

@ -19,7 +19,6 @@ package org.jivesoftware.smackx.muc.packet;
import org.jivesoftware.smack.packet.IQ;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@ -36,13 +35,13 @@ public class MUCOwner extends IQ {
private Destroy destroy;
/**
* Returns a Collection of item childs that holds information about affiliation,
* Returns a List of item childs that holds information about affiliation,
* jids and nicks.
*
* @return a Collection of item childs that holds information about affiliation,
* @return a List of item childs that holds information about affiliation,
* jids and nicks.
*/
public Collection<Item> getItems() {
public List<Item> getItems() {
synchronized (items) {
return Collections.unmodifiableList(new ArrayList<Item>(items));
}

View file

@ -22,7 +22,6 @@ import org.jivesoftware.smack.provider.IQProvider;
import org.xmlpull.v1.XmlPullParser;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@ -39,13 +38,13 @@ public class OfflineMessageRequest extends IQ {
private boolean fetch = false;
/**
* Returns a Collection of item childs that holds information about offline messages to
* Returns a List of item childs that holds information about offline messages to
* view or delete.
*
* @return a Collection of item childs that holds information about offline messages to
* @return a List of item childs that holds information about offline messages to
* view or delete.
*/
public Collection<Item> getItems() {
public List<Item> getItems() {
synchronized (items) {
return Collections.unmodifiableList(new ArrayList<Item>(items));
}