Class MapUtils
java.lang.Object
org.aksw.commons.collections.MapUtils
Created by IntelliJ IDEA.
User: raven
Date: 4/22/11
Time: 2:36 PM
To change this template use File | Settings | File Templates.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> intaddWithIntegerAutoIncrement(Map<T, Integer> map, T key) static <T> longaddWithLongAutoIncrement(Map<T, Long> map, T key) static <K,V> Map <K, V> createChainMap(Map<K, ?> a, Map<?, V> b) static <K,V> Map <K, V> difference(Map<K, ? extends V> map, Set<? super K> deletions) Returns a view of the map where all keys present in 'deletions' are hiddenstatic <K,V> V getOrCreate(Map<K, V> map, K key, Class<V> clazz, Object... ctorArgs) static <K,V> V static <K,V> Map <K, V> index(Collection<? extends K> keys, Function<K, V> fn) static <K,V> Map <K, V> index(Collection<? extends K> keys, Function<K, V> fn, Map<K, V> result) static <K,V> Map <K, V> indexIdentity(Collection<? extends K> keys, Function<K, V> fn) 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>>
RmergeCompatible(Iterable<? extends Map<? extends K, ? extends V>> maps, Supplier<R> resultSupplier) / ListquadGroups = new ArrayList (cnfToQuadGroup.values()); static <K, V, R extends Map<K,V>>
RmergeCompatible(Map<? extends K, ? extends V> a, Map<? extends K, ? extends V> b, Supplier<R> resultSupplier) static <K,V> void Set the same value for a given set of keysstatic <K,V> V putWithRemoveOnNull(Map<K, V> map, K key, V value) Put a key value pair.static voidstatic <K,V> com.google.common.collect.Multimap <V, K> static <K,V> Map <K, V> transformKeys(Map<K, V> original, Function<? super K, ? extends K> map) static <K,V> Map <K, V> Returns a view of the union of two maps.static <K,V> Map <K, V> union(Map<K, ? extends V> a, Map<K, ? extends V> b, BinaryOperator<V> conflictHandler) Returns a view of the union of two maps.
-
Constructor Details
-
MapUtils
public MapUtils()
-
-
Method Details
-
addWithIntegerAutoIncrement
-
addWithLongAutoIncrement
-
removeAll
-
putForAll
-
isCompatible
public 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. Or put differently: The union of the two maps retains a functional mapping.- Type Parameters:
K-V-- Parameters:
a-b-- Returns:
-
isCompatible
-
isPartiallyCompatible
Deprecated. -
reverse
-
getOrElse
-
createChainMap
-
getOrCreate
-
mergeCompatible
-
mergeCompatible
-
union
Returns a view of the union of two maps. For all keys k, if either map contains a value for k, the returned map contains that value. If both maps contain a value for the same key, this map contains the value in the second of the two provided maps. -
union
public static <K,V> Map<K,V> union(Map<K, ? extends V> a, Map<K, ? extends V> b, BinaryOperator<V> conflictHandler) Returns a view of the union of two maps. For all keys k, if either map contains a value for k, the returned map contains that value. If both maps contain a value for the same key, the conflict is resolved with the provided function. -
difference
-
index
-
indexIdentity
-
index
-
transformKeys
-
putWithRemoveOnNull
Put a key value pair. Removes the key if the value is null. Returns the prior value (null if there was none).
-