private <T, R> R getSingleValue(List<T> values, Function<T, R> mapper) {

        T value = getSingleValue(values);
        if (value == null)
            return null;

        return mapper.apply(value);

    }
Returns the single value stored in the given list, additionally
performing a mapping transformation on the single value. If the list is
empty or contains multiple values, null is returned. Note that null will
also be returned if the mapping transformation returns null for the
single value stored in the list.

@param <T>
    The type of object stored in the list.

@param <R>
    The type of object to return.

@param values
    The list to retrieve a single value from.

@param mapper
    The function to use to map the single object of type T to type R.

@return
    The single value stored in the given list, transformed using the
    provided mapping function, or null if the list is empty or contains
    multiple values.
extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/secret/KsmRecordService.java