Class MapIterate
- java.lang.Object
-
- org.eclipse.collections.impl.utility.MapIterate
-
public final class MapIterate extends Object
The MapIterate class provides a few of the methods from the Smalltalk Collection Protocol. This includes:- select: -- a.k.a. filter
- reject: -- a.k.a. not-filter
- collect: -- a.k.a. transform, map, tear-off
- inject:into: -- closely related to reduce and fold
- detect: -- a.k.a. find, search
- detect:ifNone:
- anySatisfy: -- a.k.a. exists
- allSatisfy:
Iterate
methods.- Since:
- 1.0
- See Also:
Iterate
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V>
Collection<K>addAllKeysTo(Map<K,V> map, Collection<K> targetCollection)
Adds all the keys from map to the specified targetCollection.static <K,V>
Collection<V>addAllValuesTo(Map<K,V> map, Collection<V> targetCollection)
Adds all the values from map to the specified targetCollection.static <K,V>
booleanallSatisfy(Map<K,V> map, Predicate<? super V> predicate)
static <K,V>
booleananySatisfy(Map<K,V> map, Predicate<? super V> predicate)
static <K,V,A>
MutableList<A>collect(Map<K,V> map, Function<? super V,? extends A> function)
static <K,V,A,R extends Collection<A>>
Rcollect(Map<K,V> map, Function<? super V,? extends A> function, R targetCollection)
static <K,V,K2,V2>
MutableMap<K2,V2>collect(Map<K,V> map, Function2<? super K,? super V,Pair<K2,V2>> function)
For each value of the map, the function is evaluated with the key and value as the parameter.static <K1,V1,K2,V2>
MutableMap<K2,V2>collect(Map<K1,V1> map, Function<? super K1,? extends K2> keyFunction, Function<? super V1,? extends V2> valueFunction)
For each key-value entry of a map, applies a function to each, and adds the transformed entry to a new Map.static <K1,V1,K2,V2>
MutableMap<K2,V2>collect(Map<K1,V1> map, Function<? super K1,? extends K2> keyFunction, Function<? super V1,? extends V2> valueFunction, Map<K2,V2> target)
For each key-value entry of a map, applies a function to each, and adds the transformed entry to the target Map.static <K1,V1,K2,V2,R extends Map<K2,V2>>
Rcollect(Map<K1,V1> map, Function2<? super K1,? super V1,Pair<K2,V2>> function, R target)
For each value of the map, the function is evaluated with the key and value as the parameter.static <K,V>
MutableBooleanCollectioncollectBoolean(Map<K,V> map, BooleanFunction<? super V> booleanFunction)
static <K,V,R extends MutableBooleanCollection>
RcollectBoolean(Map<K,V> map, BooleanFunction<? super V> booleanFunction, R target)
static <K,V>
MutableByteCollectioncollectByte(Map<K,V> map, ByteFunction<? super V> byteFunction)
static <K,V,R extends MutableByteCollection>
RcollectByte(Map<K,V> map, ByteFunction<? super V> byteFunction, R target)
static <K,V>
MutableCharCollectioncollectChar(Map<K,V> map, CharFunction<? super V> charFunction)
static <K,V,R extends MutableCharCollection>
RcollectChar(Map<K,V> map, CharFunction<? super V> charFunction, R target)
static <K,V>
MutableDoubleCollectioncollectDouble(Map<K,V> map, DoubleFunction<? super V> doubleFunction)
static <K,V,R extends MutableDoubleCollection>
RcollectDouble(Map<K,V> map, DoubleFunction<? super V> doubleFunction, R target)
static <K,V>
MutableFloatCollectioncollectFloat(Map<K,V> map, FloatFunction<? super V> floatFunction)
static <K,V,R extends MutableFloatCollection>
RcollectFloat(Map<K,V> map, FloatFunction<? super V> floatFunction, R target)
static <K1,V1,K2,V2>
MutableMap<K2,V2>collectIf(Map<K1,V1> map, Function2<? super K1,? super V1,Pair<K2,V2>> function, Predicate2<? super K1,? super V1> predicate)
For each value of the map, the Predicate2 is evaluated with the key and value as the parameter, and if true, thenfunction
is applied.static <K1,V1,K2,V2>
MutableMap<K2,V2>collectIf(Map<K1,V1> map, Function2<? super K1,? super V1,Pair<K2,V2>> function, Predicate2<? super K1,? super V1> predicate, Map<K2,V2> target)
For each value of the map, the Predicate2 is evaluated with the key and value as the parameter, and if true, thenfunction
is applied.static <K,V>
MutableIntCollectioncollectInt(Map<K,V> map, IntFunction<? super V> intFunction)
static <K,V,R extends MutableIntCollection>
RcollectInt(Map<K,V> map, IntFunction<? super V> intFunction, R target)
static <K,V>
MutableLongCollectioncollectLong(Map<K,V> map, LongFunction<? super V> longFunction)
static <K,V,R extends MutableLongCollection>
RcollectLong(Map<K,V> map, LongFunction<? super V> longFunction, R target)
static <K,V>
MutableShortCollectioncollectShort(Map<K,V> map, ShortFunction<? super V> shortFunction)
static <K,V,R extends MutableShortCollection>
RcollectShort(Map<K,V> map, ShortFunction<? super V> shortFunction, R target)
static <K,V,V2>
MutableMap<K,V2>collectValues(Map<K,V> map, Function2<? super K,? super V,? extends V2> function)
For each key and value of the map, the function is evaluated with the key and value as the parameter.static <K,V,V2,R extends Map<K,V2>>
RcollectValues(Map<K,V> map, Function2<? super K,? super V,? extends V2> function, R target)
For each key and value of the map, the function is evaluated with the key and value as the parameter.static <K,V>
intcount(Map<K,V> map, Predicate<? super V> predicate)
static <K,V>
Vdetect(Map<K,V> map, Predicate<? super V> predicate)
static <K,V>
Pair<K,V>detect(Map<K,V> map, Predicate2<? super K,? super V> predicate)
static <K,V>
VdetectIfNone(Map<K,V> map, Predicate<? super V> predicate, V ifNone)
static <K,V>
Optional<V>detectOptional(Map<K,V> map, Predicate<? super V> predicate)
static <K,V>
Optional<Pair<K,V>>detectOptional(Map<K,V> map, Predicate2<? super K,? super V> predicate)
static <K,V>
MutableSetMultimap<V,K>flip(MapIterable<K,V> iMap)
static <K,V>
MutableSortedSetMultimap<V,K>flip(SortedMapIterable<K,V> iMap)
static <K,V>
MutableMap<V,K>flipUniqueValues(MapIterable<K,V> mapIterable)
static <K,V>
voidforEachKey(Map<K,V> map, Procedure<? super K> procedure)
For each key of the map,procedure
is evaluated with the key as the parameter.static <K,V>
voidforEachKeyValue(Map<K,V> map, Procedure2<? super K,? super V> procedure)
For each entry of the map,procedure
is evaluated with the element as the parameter.static <K,V>
voidforEachValue(Map<K,V> map, Procedure<? super V> procedure)
For each value of the map,procedure
is evaluated with the value as the parameter.static <K,V>
VgetIfAbsent(Map<K,V> map, K key, Function0<? extends V> instanceBlock)
Get and return the value in the Map that corresponds to the specified key, or if there is no value at the key, return the result of evaluating the specifiedFunction0
.static <K,V>
VgetIfAbsentDefault(Map<K,V> map, K key, V defaultValue)
Get and return the value in the Map at the specified key, or if there is no value at the key, return thedefaultValue
.static <K,V>
VgetIfAbsentPut(Map<K,V> map, K key, Function0<? extends V> instanceBlock)
Get and return the value in the Map at the specified key, or if there is no value at the key, return the result of evaluating the specifiedFunction0
, and put that value in the map at the specified key.static <K,V,P>
VgetIfAbsentPutWith(Map<K,V> map, K key, Function<? super P,? extends V> function, P parameter)
Get and return the value in the Map at the specified key, or if there is no value at the key, return the result of evaluating the specifiedFunction
with theparameter
, and put that value in the map at the specified key.static <K,V,P>
VgetIfAbsentWith(Map<K,V> map, K key, Function<? super P,? extends V> function, P parameter)
Get and return the value in the Map that corresponds to the specified key, or if there is no value at the key, return the result of evaluating the specifiedFunction
with the specified parameter.static <K,V,A>
AifPresentApply(Map<K,V> map, K key, Function<? super V,? extends A> function)
If there is a value in the Map that the specified key, return the result of applying the specified Function on the value, otherwise return null.static <K,V,IV>
IVinjectInto(IV injectValue, Map<K,V> map, Function2<? super IV,? super V,? extends IV> function)
static <IV,K,V>
IVinjectIntoIf(IV initialValue, Map<K,V> map, Predicate<? super V> predicate, Function2<? super IV,? super V,? extends IV> function)
Same asinjectInto(Object, Map, Function2)
, but only applies the value to the function if the predicate returns true for the value.static boolean
isEmpty(Map<?,?> map)
A null-safe check on a map to see if it isEmpty.static <K,V>
booleannoneSatisfy(Map<K,V> map, Predicate<? super V> predicate)
static boolean
notEmpty(Map<?,?> map)
A null-safe check on a map to see if it notEmpty.static <K,V>
intoccurrencesOf(Map<K,V> map, V object)
Return the number of occurrences of object in the specified map.static <K,V,A>
intoccurrencesOfAttribute(Map<K,V> map, Function<? super V,? extends A> function, A object)
Return the number of occurrences where object is equal to the specified attribute in the specified map.static <K,V>
MutableList<V>reject(Map<K,V> map, Predicate<? super V> predicate)
static <K,V,R extends Collection<V>>
Rreject(Map<K,V> map, Predicate<? super V> predicate, R targetCollection)
static <K,V>
MutableMap<K,V>rejectMapOnEntry(Map<K,V> map, Predicate2<? super K,? super V> predicate)
For each value of the map, predicate is evaluated with the element as the parameter.static <K,V,R extends Map<K,V>>
RrejectMapOnEntry(Map<K,V> map, Predicate2<? super K,? super V> predicate, R target)
For each value of the map, predicate is evaluated with the element as the parameter.static <K,V>
MutableMap<V,K>reverseMapping(Map<K,V> map)
Return a new map swapping key-value for value-key.static <K,V>
MutableList<V>select(Map<K,V> map, Predicate<? super V> predicate)
static <K,V,R extends Collection<V>>
Rselect(Map<K,V> map, Predicate<? super V> predicate, R targetCollection)
static <K,V>
MutableMap<K,V>selectMapOnEntry(Map<K,V> map, Predicate2<? super K,? super V> predicate)
For each entry of the source map, the Predicate2 is evaluated.static <K,V,R extends Map<K,V>>
RselectMapOnEntry(Map<K,V> map, Predicate2<? super K,? super V> predicate, R target)
For each entry of the source map, the Predicate2 is evaluated.static <K,V>
MutableMap<K,V>selectMapOnKey(Map<K,V> map, Predicate<? super K> predicate)
For each key of the source map, the Predicate is evaluated.static <K,V>
MutableMap<K,V>selectMapOnValue(Map<K,V> map, Predicate<? super V> predicate)
For each value of the source map, the Predicate is evaluated.static <K,V>
MutableList<Pair<K,V>>toListOfPairs(Map<K,V> map)
Iterate over the specified map applying the specified Function to each value and return the results as a List.static <K,V>
MutableList<V>toSortedList(Map<K,V> map, Comparator<? super V> comparator)
Iterate over the specified map applying the specified Function to each value and return the results as a sorted List using the specified Comparator.
-
-
-
Method Detail
-
isEmpty
public static boolean isEmpty(Map<?,?> map)
A null-safe check on a map to see if it isEmpty. A null collection results intrue
.
-
notEmpty
public static boolean notEmpty(Map<?,?> map)
A null-safe check on a map to see if it notEmpty. A null collection results infalse
.
-
getIfAbsentPut
public static <K,V> V getIfAbsentPut(Map<K,V> map, K key, Function0<? extends V> instanceBlock)
Get and return the value in the Map at the specified key, or if there is no value at the key, return the result of evaluating the specifiedFunction0
, and put that value in the map at the specified key.This method handles the
null
-value-at-key case correctly.
-
getIfAbsentPutWith
public static <K,V,P> V getIfAbsentPutWith(Map<K,V> map, K key, Function<? super P,? extends V> function, P parameter)
Get and return the value in the Map at the specified key, or if there is no value at the key, return the result of evaluating the specifiedFunction
with theparameter
, and put that value in the map at the specified key.
-
getIfAbsent
public static <K,V> V getIfAbsent(Map<K,V> map, K key, Function0<? extends V> instanceBlock)
Get and return the value in the Map that corresponds to the specified key, or if there is no value at the key, return the result of evaluating the specifiedFunction0
.
-
getIfAbsentWith
public static <K,V,P> V getIfAbsentWith(Map<K,V> map, K key, Function<? super P,? extends V> function, P parameter)
Get and return the value in the Map that corresponds to the specified key, or if there is no value at the key, return the result of evaluating the specifiedFunction
with the specified parameter.
-
getIfAbsentDefault
public static <K,V> V getIfAbsentDefault(Map<K,V> map, K key, V defaultValue)
Get and return the value in the Map at the specified key, or if there is no value at the key, return thedefaultValue
.
-
ifPresentApply
public static <K,V,A> A ifPresentApply(Map<K,V> map, K key, Function<? super V,? extends A> function)
If there is a value in the Map that the specified key, return the result of applying the specified Function on the value, otherwise return null.
-
select
public static <K,V> MutableList<V> select(Map<K,V> map, Predicate<? super V> predicate)
- See Also:
Iterate.select(Iterable, Predicate)
-
select
public static <K,V,R extends Collection<V>> R select(Map<K,V> map, Predicate<? super V> predicate, R targetCollection)
-
count
public static <K,V> int count(Map<K,V> map, Predicate<? super V> predicate)
- See Also:
Iterate.count(Iterable, Predicate)
-
selectMapOnEntry
public static <K,V> MutableMap<K,V> selectMapOnEntry(Map<K,V> map, Predicate2<? super K,? super V> predicate)
For each entry of the source map, the Predicate2 is evaluated. If the result of the evaluation is true, the map entry is moved to a result map. The result map is returned containing all entries in the source map that evaluated to true.
-
selectMapOnEntry
public static <K,V,R extends Map<K,V>> R selectMapOnEntry(Map<K,V> map, Predicate2<? super K,? super V> predicate, R target)
For each entry of the source map, the Predicate2 is evaluated. If the result of the evaluation is true, the map entry is moved to a result map. The result map is returned containing all entries in the source map that evaluated to true.
-
selectMapOnKey
public static <K,V> MutableMap<K,V> selectMapOnKey(Map<K,V> map, Predicate<? super K> predicate)
For each key of the source map, the Predicate is evaluated. If the result of the evaluation is true, the map entry is moved to a result map. The result map is returned containing all entries in the source map that evaluated to true.
-
selectMapOnValue
public static <K,V> MutableMap<K,V> selectMapOnValue(Map<K,V> map, Predicate<? super V> predicate)
For each value of the source map, the Predicate is evaluated. If the result of the evaluation is true, the map entry is moved to a result map. The result map is returned containing all entries in the source map that evaluated to true.
-
reject
public static <K,V> MutableList<V> reject(Map<K,V> map, Predicate<? super V> predicate)
- See Also:
Iterate.reject(Iterable, Predicate)
-
reject
public static <K,V,R extends Collection<V>> R reject(Map<K,V> map, Predicate<? super V> predicate, R targetCollection)
-
rejectMapOnEntry
public static <K,V> MutableMap<K,V> rejectMapOnEntry(Map<K,V> map, Predicate2<? super K,? super V> predicate)
For each value of the map, predicate is evaluated with the element as the parameter. Each element which causes predicate to evaluate to false is included in the new collection.
-
rejectMapOnEntry
public static <K,V,R extends Map<K,V>> R rejectMapOnEntry(Map<K,V> map, Predicate2<? super K,? super V> predicate, R target)
For each value of the map, predicate is evaluated with the element as the parameter. Each element which causes predicate to evaluate to false is added to the targetCollection.
-
addAllKeysTo
public static <K,V> Collection<K> addAllKeysTo(Map<K,V> map, Collection<K> targetCollection)
Adds all the keys from map to the specified targetCollection.
-
addAllValuesTo
public static <K,V> Collection<V> addAllValuesTo(Map<K,V> map, Collection<V> targetCollection)
Adds all the values from map to the specified targetCollection.
-
collect
public static <K,V,A> MutableList<A> collect(Map<K,V> map, Function<? super V,? extends A> function)
- See Also:
Iterate.collect(Iterable, Function)
-
collectBoolean
public static <K,V> MutableBooleanCollection collectBoolean(Map<K,V> map, BooleanFunction<? super V> booleanFunction)
-
collectBoolean
public static <K,V,R extends MutableBooleanCollection> R collectBoolean(Map<K,V> map, BooleanFunction<? super V> booleanFunction, R target)
-
collectByte
public static <K,V> MutableByteCollection collectByte(Map<K,V> map, ByteFunction<? super V> byteFunction)
- See Also:
RichIterable.collectByte(ByteFunction)
-
collectByte
public static <K,V,R extends MutableByteCollection> R collectByte(Map<K,V> map, ByteFunction<? super V> byteFunction, R target)
-
collectChar
public static <K,V> MutableCharCollection collectChar(Map<K,V> map, CharFunction<? super V> charFunction)
- See Also:
RichIterable.collectChar(CharFunction)
-
collectChar
public static <K,V,R extends MutableCharCollection> R collectChar(Map<K,V> map, CharFunction<? super V> charFunction, R target)
-
collectDouble
public static <K,V> MutableDoubleCollection collectDouble(Map<K,V> map, DoubleFunction<? super V> doubleFunction)
-
collectDouble
public static <K,V,R extends MutableDoubleCollection> R collectDouble(Map<K,V> map, DoubleFunction<? super V> doubleFunction, R target)
-
collectFloat
public static <K,V> MutableFloatCollection collectFloat(Map<K,V> map, FloatFunction<? super V> floatFunction)
- See Also:
RichIterable.collectFloat(FloatFunction)
-
collectFloat
public static <K,V,R extends MutableFloatCollection> R collectFloat(Map<K,V> map, FloatFunction<? super V> floatFunction, R target)
-
collectInt
public static <K,V> MutableIntCollection collectInt(Map<K,V> map, IntFunction<? super V> intFunction)
- See Also:
RichIterable.collectInt(IntFunction)
-
collectInt
public static <K,V,R extends MutableIntCollection> R collectInt(Map<K,V> map, IntFunction<? super V> intFunction, R target)
-
collectLong
public static <K,V> MutableLongCollection collectLong(Map<K,V> map, LongFunction<? super V> longFunction)
- See Also:
RichIterable.collectLong(LongFunction)
-
collectLong
public static <K,V,R extends MutableLongCollection> R collectLong(Map<K,V> map, LongFunction<? super V> longFunction, R target)
-
collectShort
public static <K,V> MutableShortCollection collectShort(Map<K,V> map, ShortFunction<? super V> shortFunction)
- See Also:
RichIterable.collectShort(ShortFunction)
-
collectShort
public static <K,V,R extends MutableShortCollection> R collectShort(Map<K,V> map, ShortFunction<? super V> shortFunction, R target)
-
collect
public static <K,V,K2,V2> MutableMap<K2,V2> collect(Map<K,V> map, Function2<? super K,? super V,Pair<K2,V2>> function)
For each value of the map, the function is evaluated with the key and value as the parameter. The results of these evaluations are collected into a new UnifiedMap.
-
collect
public static <K1,V1,K2,V2,R extends Map<K2,V2>> R collect(Map<K1,V1> map, Function2<? super K1,? super V1,Pair<K2,V2>> function, R target)
For each value of the map, the function is evaluated with the key and value as the parameter. The results of these evaluations are collected into the target map.
-
collectValues
public static <K,V,V2> MutableMap<K,V2> collectValues(Map<K,V> map, Function2<? super K,? super V,? extends V2> function)
For each key and value of the map, the function is evaluated with the key and value as the parameter. The results of these evaluations are collected into the target map.
-
collectValues
public static <K,V,V2,R extends Map<K,V2>> R collectValues(Map<K,V> map, Function2<? super K,? super V,? extends V2> function, R target)
For each key and value of the map, the function is evaluated with the key and value as the parameter. The results of these evaluations are collected into the target map.
-
collectIf
public static <K1,V1,K2,V2> MutableMap<K2,V2> collectIf(Map<K1,V1> map, Function2<? super K1,? super V1,Pair<K2,V2>> function, Predicate2<? super K1,? super V1> predicate)
For each value of the map, the Predicate2 is evaluated with the key and value as the parameter, and if true, thenfunction
is applied. The results of these evaluations are collected into a new map.
-
collectIf
public static <K1,V1,K2,V2> MutableMap<K2,V2> collectIf(Map<K1,V1> map, Function2<? super K1,? super V1,Pair<K2,V2>> function, Predicate2<? super K1,? super V1> predicate, Map<K2,V2> target)
For each value of the map, the Predicate2 is evaluated with the key and value as the parameter, and if true, thenfunction
is applied. The results of these evaluations are collected into the target map.
-
collect
public static <K1,V1,K2,V2> MutableMap<K2,V2> collect(Map<K1,V1> map, Function<? super K1,? extends K2> keyFunction, Function<? super V1,? extends V2> valueFunction)
For each key-value entry of a map, applies a function to each, and adds the transformed entry to a new Map.
-
collect
public static <K1,V1,K2,V2> MutableMap<K2,V2> collect(Map<K1,V1> map, Function<? super K1,? extends K2> keyFunction, Function<? super V1,? extends V2> valueFunction, Map<K2,V2> target)
For each key-value entry of a map, applies a function to each, and adds the transformed entry to the target Map.
-
collect
public static <K,V,A,R extends Collection<A>> R collect(Map<K,V> map, Function<? super V,? extends A> function, R targetCollection)
-
forEachValue
public static <K,V> void forEachValue(Map<K,V> map, Procedure<? super V> procedure)
For each value of the map,procedure
is evaluated with the value as the parameter.
-
forEachKey
public static <K,V> void forEachKey(Map<K,V> map, Procedure<? super K> procedure)
For each key of the map,procedure
is evaluated with the key as the parameter.
-
forEachKeyValue
public static <K,V> void forEachKeyValue(Map<K,V> map, Procedure2<? super K,? super V> procedure)
For each entry of the map,procedure
is evaluated with the element as the parameter.
-
flipUniqueValues
public static <K,V> MutableMap<V,K> flipUniqueValues(MapIterable<K,V> mapIterable)
- See Also:
MapIterable.flipUniqueValues()
-
detect
public static <K,V> Pair<K,V> detect(Map<K,V> map, Predicate2<? super K,? super V> predicate)
-
detect
public static <K,V> V detect(Map<K,V> map, Predicate<? super V> predicate)
- See Also:
Iterate.detect(Iterable, Predicate)
-
detectOptional
public static <K,V> Optional<Pair<K,V>> detectOptional(Map<K,V> map, Predicate2<? super K,? super V> predicate)
-
detectOptional
public static <K,V> Optional<V> detectOptional(Map<K,V> map, Predicate<? super V> predicate)
-
detectIfNone
public static <K,V> V detectIfNone(Map<K,V> map, Predicate<? super V> predicate, V ifNone)
-
injectInto
public static <K,V,IV> IV injectInto(IV injectValue, Map<K,V> map, Function2<? super IV,? super V,? extends IV> function)
-
injectIntoIf
public static <IV,K,V> IV injectIntoIf(IV initialValue, Map<K,V> map, Predicate<? super V> predicate, Function2<? super IV,? super V,? extends IV> function)
Same asinjectInto(Object, Map, Function2)
, but only applies the value to the function if the predicate returns true for the value.- See Also:
injectInto(Object, Map, Function2)
-
anySatisfy
public static <K,V> boolean anySatisfy(Map<K,V> map, Predicate<? super V> predicate)
- See Also:
Iterate.anySatisfy(Iterable, Predicate)
-
allSatisfy
public static <K,V> boolean allSatisfy(Map<K,V> map, Predicate<? super V> predicate)
- See Also:
Iterate.allSatisfy(Iterable, Predicate)
-
noneSatisfy
public static <K,V> boolean noneSatisfy(Map<K,V> map, Predicate<? super V> predicate)
- See Also:
Iterate.noneSatisfy(Iterable, Predicate)
-
toListOfPairs
public static <K,V> MutableList<Pair<K,V>> toListOfPairs(Map<K,V> map)
Iterate over the specified map applying the specified Function to each value and return the results as a List.
-
toSortedList
public static <K,V> MutableList<V> toSortedList(Map<K,V> map, Comparator<? super V> comparator)
Iterate over the specified map applying the specified Function to each value and return the results as a sorted List using the specified Comparator.
-
reverseMapping
public static <K,V> MutableMap<V,K> reverseMapping(Map<K,V> map)
Return a new map swapping key-value for value-key. If the original map contains entries with the same value, the result mapping is undefined, in that the last entry applied wins (the order of application is undefined).
-
occurrencesOf
public static <K,V> int occurrencesOf(Map<K,V> map, V object)
Return the number of occurrences of object in the specified map.
-
occurrencesOfAttribute
public static <K,V,A> int occurrencesOfAttribute(Map<K,V> map, Function<? super V,? extends A> function, A object)
Return the number of occurrences where object is equal to the specified attribute in the specified map.
-
flip
public static <K,V> MutableSetMultimap<V,K> flip(MapIterable<K,V> iMap)
-
flip
public static <K,V> MutableSortedSetMultimap<V,K> flip(SortedMapIterable<K,V> iMap)
-
-