private static String getFirstValue(Map<String, List<String>> map, String key) {

        List<String> values = map.get(key);
        if (values == null || values.isEmpty())
            return null;

        return values.get(0);

    }
Returns the first value stored for the given key in the given Map. If no
such key exists in the map, or no values are associated with the given
key, null is returned.

@param map
    A Map of keys to multiple values, where each set of multiple values
    is represented by a List.

@param key
    The key to look up.

@return
    The first value stored for the given key in the given Map, or null
    if there is no such value or no such key.
guacamole-ext/src/main/java/org/apache/guacamole/net/RequestDetails.java