Class MapUtil
java.lang.Object
com.ibm.wala.util.collections.MapUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <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) groupKeysByValue
(Map<K, V> m) 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)
-
Constructor Details
-
MapUtil
public MapUtil()
-
-
Method Details
-
findOrCreateSet
- Parameters:
M
- a mapping from Object -> Set- Returns:
- the Set corresponding to key in M; create one if needed
- Throws:
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)
-
findOrCreateMutableIntSet
- Throws:
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)
-
findOrCreateCollection
- Returns:
- the Collection corresponding to key in M; create one if needed
- Throws:
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)
-
findOrCreateList
- Returns:
- the Set corresponding to key in M; create one if needed
- Throws:
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)
-
findOrCreateMap
- Parameters:
M
- a mapping from Object -> Map- Returns:
- the Map corresponding to key in M; create one if needed
- Throws:
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)
-
findOrCreateValue
- Throws:
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)
-
findOrCreateWeakHashMap
public static <K,V> WeakHashMap<K,V> findOrCreateWeakHashMap(Map<Object, WeakHashMap<K, V>> M, Object key) - Parameters:
M
- a mapping from Object -> WeakHashMap- Returns:
- the WeakHashMap corresponding to key in M; create one if needed
- Throws:
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)
-
inverseMap
-
invertOneToOneMap
invert an input map that is one-to-one (i.e., it does not map two different keys to the same value)- Throws:
IllegalArgumentException
- if m is nullIllegalArgumentException
- if m is not one-to-one
-
groupKeysByValue
-