public static Map<String, Object> toSingleValuedMap(final Map<String, Object> attributes,
                                                        final List<String> singleValuedAttributes) {
        val results = new LinkedHashMap<>(attributes);
        singleValuedAttributes.forEach(name -> {
            val values = results.remove(name);
            firstElement(values).ifPresent(value -> results.put(name, value));
        });
        return results;
    }
Ensure given attributes in the map are always captured
with a single-value, if they exist. If the requested attributes have multiple values,
the first element is chosen.

@param attributes             the attributes
@param singleValuedAttributes the single valued attributes
@return the map
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/CollectionUtils.java