| Constructor and Description |
|---|
MapUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <K,T> Collection<T> |
findOrCreateCollection(Map<K,Collection<T>> M,
K key) |
static <K,T> List<T> |
findOrCreateList(Map<K,List<T>> M,
K key) |
static <K,K2,V> Map<K2,V> |
findOrCreateMap(Map<K,Map<K2,V>> M,
K key) |
static <K> MutableIntSet |
findOrCreateMutableIntSet(Map<K,MutableIntSet> M,
K key) |
static <K,T> Set<T> |
findOrCreateSet(Map<K,Set<T>> M,
K key) |
static <K,V> V |
findOrCreateValue(Map<K,V> M,
K key,
Factory<V> factory) |
static <K,V> WeakHashMap<K,V> |
findOrCreateWeakHashMap(Map<Object,WeakHashMap<K,V>> M,
Object key) |
static <K,V> Map<Set<K>,V> |
groupKeysByValue(Map<K,V> m) |
static <K,V> Map<V,Set<K>> |
inverseMap(Map<K,Set<V>> m) |
static <K,V> Map<V,K> |
invertOneToOneMap(Map<K,V> m)
invert an input map that is one-to-one (i.e., it does not map two different keys to the same
value)
|
public static <K,T> Set<T> findOrCreateSet(Map<K,Set<T>> M, K key)
M - a mapping from Object -> SetIllegalArgumentException - if M is nullClassCastException - if the key is of an inappropriate type for this map (optional)NullPointerException - if the specified key is null and this map does not permit null
keys (optional)public static <K> MutableIntSet findOrCreateMutableIntSet(Map<K,MutableIntSet> M, K key)
ClassCastException - if the key is of an inappropriate type for this map (optional)NullPointerException - if the specified key is null and this map does not permit null
keys (optional)public static <K,T> Collection<T> findOrCreateCollection(Map<K,Collection<T>> M, K key)
ClassCastException - if the key is of an inappropriate type for this map (optional)NullPointerException - if the specified key is null and this map does not permit null
keys (optional)public static <K,T> List<T> findOrCreateList(Map<K,List<T>> M, K key)
IllegalArgumentException - if M is nullClassCastException - if the key is of an inappropriate type for this map (optional)NullPointerException - if the specified key is null and this map does not permit null
keys (optional)public static <K,K2,V> Map<K2,V> findOrCreateMap(Map<K,Map<K2,V>> M, K key)
M - a mapping from Object -> MapIllegalArgumentException - if M is nullClassCastException - if the key is of an inappropriate type for this map (optional)NullPointerException - if the specified key is null and this map does not permit null
keys (optional)public static <K,V> V findOrCreateValue(Map<K,V> M, K key, Factory<V> factory)
ClassCastException - if the key is of an inappropriate type for this map (optional)NullPointerException - if the specified key is null and this map does not permit null
keys (optional)public static <K,V> WeakHashMap<K,V> findOrCreateWeakHashMap(Map<Object,WeakHashMap<K,V>> M, Object key)
M - a mapping from Object -> WeakHashMapIllegalArgumentException - if M is nullClassCastException - if the key is of an inappropriate type for this map (optional)NullPointerException - if the specified key is null and this map does not permit null
keys (optional)public static <K,V> Map<V,Set<K>> inverseMap(Map<K,Set<V>> m)
m - a map from key -> Set<value>Set<key>IllegalArgumentException - if m is nullpublic static <K,V> Map<V,K> invertOneToOneMap(Map<K,V> m)
IllegalArgumentException - if m is nullIllegalArgumentException - if m is not one-to-one