Make getServiceNames() return List

instead of Collection. Return types should always be as specific as
possible. Because e.g. Collection does not allow 'get(0)', but List
does.
This commit is contained in:
Florian Schmaus 2014-10-12 16:52:49 +02:00
parent fe74fc23dc
commit 38582eed84
2 changed files with 3 additions and 3 deletions

View File

@ -261,7 +261,7 @@ public class MultiUserChat {
* @throws NoResponseException * @throws NoResponseException
* @throws NotConnectedException * @throws NotConnectedException
*/ */
public static Collection<String> getServiceNames(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException { public static List<String> getServiceNames(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection); ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
return sdm.findServices(MUCInitialPresence.NAMESPACE, false, false); return sdm.findServices(MUCInitialPresence.NAMESPACE, false, false);
} }

View File

@ -23,7 +23,7 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.xdata.Form; import org.jivesoftware.smackx.xdata.Form;
import java.util.Collection; import java.util.List;
/** /**
* The UserSearchManager is a facade built upon Jabber Search Services (XEP-055) to allow for searching * The UserSearchManager is a facade built upon Jabber Search Services (XEP-055) to allow for searching
@ -95,7 +95,7 @@ public class UserSearchManager {
* @throws NoResponseException * @throws NoResponseException
* @throws NotConnectedException * @throws NotConnectedException
*/ */
public Collection<String> getSearchServices() throws NoResponseException, XMPPErrorException, NotConnectedException { public List<String> getSearchServices() throws NoResponseException, XMPPErrorException, NotConnectedException {
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(con); ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(con);
return discoManager.findServices(UserSearch.NAMESPACE, false, false); return discoManager.findServices(UserSearch.NAMESPACE, false, false);
} }