public class MapUtils extends Object
| Constructor and Description |
|---|
MapUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> int |
addWithIntegerAutoIncrement(Map<T,Integer> map,
T key) |
static <T> long |
addWithLongAutoIncrement(Map<T,Long> map,
T key) |
static <K,V> Map<K,V> |
createChainMap(Map<K,?> a,
Map<?,V> b) |
static <K,V> V |
getOrCreate(Map<K,V> map,
K key,
Class<V> clazz,
Object... ctorArgs) |
static <K,V> V |
getOrElse(Map<? extends K,? extends V> map,
K key,
V elze) |
static <K,V> boolean |
isCompatible(Map<? extends K,? extends V> a,
Map<? extends K,? extends V> b)
Compatible means that merging the two maps would not result in the same
key being mapped to distinct values.
|
static <K,V> boolean |
isCompatible(Set<? extends K> keysToTest,
Map<? extends K,? extends V> a,
Map<? extends K,? extends V> b) |
static <K,V> boolean |
isPartiallyCompatible(Map<K,V> a,
Map<K,V> b)
Deprecated.
|
static <K,V,R extends Map<K,V>> |
mergeCompatible(Iterable<? extends Map<? extends K,? extends V>> maps,
java.util.function.Supplier<R> resultSupplier)
Find a mapping of variables from cand to query, such that the pattern of
cand becomes a subset of that of query
null if no mapping can be established
|
static <K,V,R extends Map<K,V>> |
mergeCompatible(Map<? extends K,? extends V> a,
Map<? extends K,? extends V> b,
java.util.function.Supplier<R> resultSupplier) |
static <K,V> void |
putForAll(Map<K,V> map,
Iterable<K> keys,
V value)
Set the same value for a given set of keys
|
static void |
removeAll(Map<?,?> map,
Iterable<?> items) |
static <K,V> com.google.common.collect.Multimap<V,K> |
reverse(Map<K,V> map) |
public static <T> int addWithIntegerAutoIncrement(Map<T,Integer> map, T key)
public static <K,V> void putForAll(Map<K,V> map, Iterable<K> keys, V value)
map - keys - value - public static <K,V> boolean isCompatible(Map<? extends K,? extends V> a, Map<? extends K,? extends V> b)
K - V - a - b - public static <K,V> boolean isCompatible(Set<? extends K> keysToTest, Map<? extends K,? extends V> a, Map<? extends K,? extends V> b)
@Deprecated public static <K,V> boolean isPartiallyCompatible(Map<K,V> a, Map<K,V> b)
public static <K,V> com.google.common.collect.Multimap<V,K> reverse(Map<K,V> map)
public static <K,V> V getOrElse(Map<? extends K,? extends V> map, K key, V elze)
public static <K,V> V getOrCreate(Map<K,V> map, K key, Class<V> clazz, Object... ctorArgs)
public static <K,V,R extends Map<K,V>> R mergeCompatible(Iterable<? extends Map<? extends K,? extends V>> maps, java.util.function.Supplier<R> resultSupplier)
query - cand - public static <K,V,R extends Map<K,V>> R mergeCompatible(Map<? extends K,? extends V> a, Map<? extends K,? extends V> b, java.util.function.Supplier<R> resultSupplier)
Copyright © 2018. All rights reserved.