public final class MapUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static Object[] |
getKeyObjects(Map<?,?> m) |
static String[] |
getKeyStrings(Map<?,?> m) |
static <K> Set<K> |
getNullValueKeys(Map<K,?> m) |
static <K,V> V |
getWithDefault(Map<K,V> m,
K key,
V defaultValue) |
static boolean |
isAllStrings(Map<?,?> m) |
static boolean |
mapsEqual(Map<?,?> m1,
Map<?,?> m2) |
static <K,V> Map<K,V> |
newMap()
assignable to any map type, keeps things short on the rhs
|
static <K,V> Map<K,V> |
newMap(Map<K,V> m1,
Map<K,V> m2)
Create a new Map consisting of a single key/value pair.
|
static Map<String,String> |
newMap(String... mappings)
Create a new Map and insert the specified mappings as found in 'mappings'.
|
static <V> Map<String,V> |
newMap(String key,
V value)
Create a new Map consisting of a single key/value pair.
|
static <T> Map<T,T> |
newMap(T... mappings)
Create a new Map and insert the specified mappings as found in 'mappings'.
|
static <K,V> Map<K,V> |
newMapNoNullValues(Map<K,V> m) |
static <K> void |
removeAll(Map<K,?> m,
Set<K> s) |
static <T> void |
removeAll(Map<T,?> m,
T[] keys)
Remove all entries keyed by 'keys'
|
static <K,V> Map<K,V> |
toMap(Object[] params,
Class<K> keyClass,
Class<V> valueClass) |
static <K,V> Map<K,V> |
toMap(Properties props,
Class<K> kClass,
Class<V> vClass) |
static String |
toString(Map<?,?> m) |
static String |
toString(Map<?,?> m,
String separator) |
static Map<String,String> |
toStringStringMap(Map<?,?> m)
Convert an arbitrary Map to one whose keys and values
are both of type String.
|
public static <K,V> V getWithDefault(Map<K,V> m, K key, V defaultValue)
public static <K,V> Map<K,V> newMap()
public static <V> Map<String,V> newMap(String key, V value)
public static <K,V> Map<K,V> newMap(Map<K,V> m1, Map<K,V> m2)
public static <T> Map<T,T> newMap(T... mappings)
public static Map<String,String> newMap(String... mappings)
public static <T> void removeAll(Map<T,?> m, T[] keys)
public static <K,V> Map<K,V> toMap(Properties props, Class<K> kClass, Class<V> vClass)
public static boolean isAllStrings(Map<?,?> m)
Copyright © 2017. All rights reserved.