src/main/java/org/jivesoftware/smack/UserRoster.java
public Iterator<Presence> getPresences(String user) {
        String key = getPresenceMapKey(user);
        Map<String, Presence> userPresences = presenceMap.get(key);
        if (userPresences == null) {
            Presence presence = new Presence(Presence.Type.unavailable);
            presence.setFrom(user);
            return Arrays.asList(presence).iterator();
        } else {
            Collection<Presence> answer = new ArrayList<Presence>();
            for (Presence presence : userPresences.values()) {
                if (presence.isAvailable()) {
                    answer.add(presence);
                }
            }
            if (!answer.isEmpty()) {
                return answer.iterator();
            } else {
                Presence presence = new Presence(Presence.Type.unavailable);
                presence.setFrom(user);
                return Arrays.asList(presence).iterator();
            }
        }
    }
public Iterator<Presence> getPresences(String user) {
        String key = getPresenceMapKey(user);
        Map<String, Presence> userPresences = presenceMap.get(key);
        if (userPresences == null) {
            Presence presence = new Presence(Presence.Type.unavailable);
            presence.setFrom(user);
            return Arrays.asList(presence).iterator();
        } else {
            Collection<Presence> answer = new ArrayList<Presence>();
            for (Presence presence : userPresences.values()) {
                if (presence.isAvailable()) {
                    answer.add(presence);
                }
            }
            if (!answer.isEmpty()) {
                return answer.iterator();
            } else {
                Presence presence = new Presence(Presence.Type.unavailable);
                presence.setFrom(user);
                return Arrays.asList(presence).iterator();
            }
        }
    }
public Iterator < Presence > getPresences ( String user ) { String key = getPresenceMapKey ( user ) ; Map < String , Presence > userPresences = presenceMap . get ( key ) ; if ( userPresences == null ) { Presence presence = new Presence ( Presence . Type . unavailable ) ; presence . setFrom ( user ) ; return Arrays . asList ( presence ) . iterator ( ) ; } else { Collection < Presence > answer = new ArrayList < Presence > ( ) ; for ( Presence presence : userPresences . values ( ) ) { if ( presence . isAvailable ( ) ) { answer . add ( presence ) ; } } if ( ! answer . isEmpty ( ) ) { return answer . iterator ( ) ; } else { Presence presence = new Presence ( Presence . Type . unavailable ) ; presence . setFrom ( user ) ; return Arrays . asList ( presence ) . iterator ( ) ; } } }
Returns an iterator (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 iterator (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.
Returns an iterator ( 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 .