public class MapUtilities extends Object
Modifier and Type | Method and Description |
---|---|
static <T,U,V> Map<T,Map<U,V>> |
cloneMapOfMaps(Map<T,Map<U,V>> original,
boolean immutable) |
static <T,V> Map<T,Set<V>> |
cloneMapOfSets(Map<T,Set<V>> original,
boolean immutable) |
static <T> Map<Class<?>,Set<T>> |
dupe(Map<Class<?>,Set<T>> other,
boolean unmodifiable)
Duplicate a map of Set to Class, possibly as unmodifiable
|
static <T> T |
get(Map<?,T> map,
Object key,
T def)
Retrieves a value from a map by key
|
static <T extends Throwable> |
getOrThrow(Map<?,?> map,
Object key,
T throwable)
Retrieves a value from a map by key, if value is not found by the given key throws a 'Throwable.'
This version allows the value associated to the key to be null, and it still works.
|
static boolean |
isEmpty(Map map)
Returns null safe isEmpty check for Map
|
static <K,V> Map<K,V> |
mapOf()
For JDK1.8 support.
|
static <K,V> Map<K,V> |
mapOf(K k,
V v) |
static <K,V> Map<K,V> |
mapOf(K k1,
V v1,
K k2,
V v2) |
static <K,V> Map<K,V> |
mapOf(K k1,
V v1,
K k2,
V v2,
K k3,
V v3) |
static <K,V> Map<K,V> |
mapOf(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4) |
static <K,V> Map<K,V> |
mapOf(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5) |
static <K,V> Map<K,V> |
mapOf(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6) |
public static <T> T get(Map<?,T> map, Object key, T def)
map
- Map to retrieve item fromkey
- the key whose associated value is to be returneddef
- value to return if item was not found.public static <T extends Throwable> Object getOrThrow(Map<?,?> map, Object key, T throwable) throws T extends Throwable
T
- Throwable passed in to be thrown *if* the passed in key is not within the passed in map.map
- Map to retrieve item fromkey
- the key whose associated value is to be returnedthrowable
- T extends Throwable
public static boolean isEmpty(Map map)
map
- Map to check, can be nullpublic static <T> Map<Class<?>,Set<T>> dupe(Map<Class<?>,Set<T>> other, boolean unmodifiable)
other
- map to duplicateunmodifiable
- will the result be unmodifiablepublic static <T,V> Map<T,Set<V>> cloneMapOfSets(Map<T,Set<V>> original, boolean immutable)
public static <T,U,V> Map<T,Map<U,V>> cloneMapOfMaps(Map<T,Map<U,V>> original, boolean immutable)
public static <K,V> Map<K,V> mapOf()
public static <K,V> Map<K,V> mapOf(K k, V v)
public static <K,V> Map<K,V> mapOf(K k1, V v1, K k2, V v2)
public static <K,V> Map<K,V> mapOf(K k1, V v1, K k2, V v2, K k3, V v3)
public static <K,V> Map<K,V> mapOf(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
public static <K,V> Map<K,V> mapOf(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)
public static <K,V> Map<K,V> mapOf(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6)
Copyright © 2024. All rights reserved.