Package com.nimbusds.oauth2.sdk.util
Class MultivaluedMapUtils
- java.lang.Object
-
- com.nimbusds.oauth2.sdk.util.MultivaluedMapUtils
-
public final class MultivaluedMapUtils extends Object
Multi-valued map utilities.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V>
VgetFirstValue(Map<K,List<V>> map, K key)
Gets the first value for the specified key.static <K,V>
VremoveAndReturnFirstValue(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 Detail
-
toSingleValuedMap
public 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.- Parameters:
map
- The multi-valued map,null
if not specified.- Returns:
- The single-valued map,
null
if no map was specified.
-
getFirstValue
public static <K,V> V getFirstValue(Map<K,List<V>> map, K key)
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
public static <K,V> V removeAndReturnFirstValue(Map<K,List<V>> map, String key)
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.
-
-