private Collection<String> getPreferredConnections(ModeledAuthenticatedUser user,
            Collection<String> identifiers) {

        // Search provided identifiers for any preferred connections
        for (String identifier : identifiers) {

            // If at least one prefferred connection is found, assume it is the
            // only preferred connection
            if (user.isPreferredConnection(identifier))
                return Collections.singletonList(identifier);

        }

        // No preferred connections were found
        return identifiers;

    }
Filters the given collection of connection identifiers, returning a new
collection which contains only those identifiers which are preferred. If
no connection identifiers within the given collection are preferred, the
collection is left untouched.

@param user
    The user whose preferred connections should be used to filter the
    given collection of connection identifiers.

@param identifiers
    The collection of connection identifiers that should be filtered.

@return
    A collection of connection identifiers containing only the subset of
    connection identifiers which are also preferred or, if none of the
    provided identifiers are preferred, the original collection of
    identifiers.
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/AbstractGuacamoleTunnelService.java