Package com.nimbusds.oauth2.sdk.util
Class MultivaluedMapUtils
java.lang.Object
com.nimbusds.oauth2.sdk.util.MultivaluedMapUtils
Multi-valued map utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,
V> V getFirstValue
(Map<K, List<V>> map, K key) Gets the first value for the specified key.static <K,
V> Set<K> getKeysWithMoreThanOneValue
(Map<K, List<V>> map, Set<K> excepted) Returns the keys with more than one distinct value.static <K,
V> V removeAndReturnFirstValue
(Map<K, List<V>> map, String key) Removes the entry for the specified key and returns its first value.static <K,
V> Map<K, V> toSingleValuedMap
(Map<K, List<V>> map) Converts the specified multi-valued map to a single-valued map by taking the first value in the list.
-
Method Details
-
toSingleValuedMap
Converts the specified multi-valued map to a single-valued map by taking the first value in the list.- Parameters:
map
- The multi-valued map,null
if not specified.- Returns:
- The single-valued map,
null
if no map was specified.
-
getFirstValue
Gets the first value for the specified key.- Parameters:
map
- The multi-valued map. Must not benull
.key
- The key. Must not benull
.- Returns:
- The first value,
null
if not set.
-
removeAndReturnFirstValue
Removes the entry for the specified key and returns its first value.- Parameters:
map
- The multi-valued map. Must not benull
.key
- The key. Must not benull
.- Returns:
- The first value,
null
if not set.
-
getKeysWithMoreThanOneValue
Returns the keys with more than one distinct value. Keys that map to two or more identical values are treated as single-valued.- Parameters:
map
- The multi-valued map,null
if not specified.excepted
- The excepted keys,null
or empty if none.- Returns:
- The keys with more than one distinct value, empty set if none.
-