public <ObjectType extends Identifiable> Map<String, ObjectType>
        asMap(List<LDAPEntry> entries, Function<LDAPEntry, ObjectType> mapper) {

        // Convert each entry to the corresponding Guacamole API object
        Map<String, ObjectType> objects = new HashMap<>(entries.size());
        for (LDAPEntry entry : entries) {

            ObjectType object = mapper.apply(entry);
            if (object == null) {
                logger.debug("Ignoring object \"{}\".", entry.getDN());
                continue;
            }

            // Attempt to add object to map, warning if the object appears
            // to be a duplicate
            String identifier = object.getIdentifier();
            if (objects.putIfAbsent(identifier, object) != null)
                logger.warn("Multiple objects ambiguously map to the "
                        + "same identifier (\"{}\"). Ignoring \"{}\" as "
                        + "a duplicate.", identifier, entry.getDN());

        }

        return objects;

    }
public < ObjectType extends Identifiable > Map < String , ObjectType > asMap ( List < LDAPEntry > entries , Function < LDAPEntry , ObjectType > mapper ) { Map < String , ObjectType > objects = new HashMap < > ( entries . size ( ) ) ; for ( LDAPEntry entry : entries ) { ObjectType object = mapper . apply ( entry ) ; if ( object == null ) { logger . debug ( "Ignoring object \"{}\"." , entry . getDN ( ) ) ; continue ; } String identifier = object . getIdentifier ( ) ; if ( objects . putIfAbsent ( identifier , object ) != null ) logger . warn ( "Multiple objects ambiguously map to the " + "same identifier (\"{}\"). Ignoring \"{}\" as " + "a duplicate." , identifier , entry . getDN ( ) ) ; } return objects ; }
Converts a given list of LDAP entries to a {@link Map} of Guacamole
objects stored by their identifiers.

@param <ObjectType>
The type of object to store within the {@link Map}.

@param entries
A list of LDAP entries to convert to Guacamole objects.

@param mapper
A mapping function which converts a given LDAP entry to its
corresponding Guacamole object. If the LDAP entry cannot be
converted, null should be returned.

@return
A new {@link Map} containing Guacamole object versions of each of
the given LDAP entries, where each object is stored within the
{@link Map} under its corresponding identifier.