public final class MapIterate
extends java.lang.Object
Iterate
methods.Iterate
Modifier and Type | Method | Description |
---|---|---|
static <K,V> java.util.Collection<K> |
addAllKeysTo(java.util.Map<K,V> map,
java.util.Collection<K> targetCollection) |
Adds all the keys from map to a the specified targetCollection.
|
static <K,V> java.util.Collection<V> |
addAllValuesTo(java.util.Map<K,V> map,
java.util.Collection<V> targetCollection) |
Adds all the values from map to a the specified targetCollection.
|
static <K,V> boolean |
allSatisfy(java.util.Map<K,V> map,
Predicate<? super V> predicate) |
|
static <K,V> boolean |
anySatisfy(java.util.Map<K,V> map,
Predicate<? super V> predicate) |
|
static <K,V,A> MutableList<A> |
collect(java.util.Map<K,V> map,
Function<? super V,? extends A> function) |
|
static <K,V,A,R extends java.util.Collection<A>> |
collect(java.util.Map<K,V> map,
Function<? super V,? extends A> function,
R targetCollection) |
|
static <K,V,K2,V2> |
collect(java.util.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> |
collect(java.util.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> |
collect(java.util.Map<K1,V1> map,
Function<? super K1,? extends K2> keyFunction,
Function<? super V1,? extends V2> valueFunction,
java.util.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 java.util.Map<K2,V2>> |
collect(java.util.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> MutableBooleanCollection |
collectBoolean(java.util.Map<K,V> map,
BooleanFunction<? super V> booleanFunction) |
|
static <K,V,R extends MutableBooleanCollection> |
collectBoolean(java.util.Map<K,V> map,
BooleanFunction<? super V> booleanFunction,
R target) |
|
static <K,V> MutableByteCollection |
collectByte(java.util.Map<K,V> map,
ByteFunction<? super V> byteFunction) |
|
static <K,V,R extends MutableByteCollection> |
collectByte(java.util.Map<K,V> map,
ByteFunction<? super V> byteFunction,
R target) |
|
static <K,V> MutableCharCollection |
collectChar(java.util.Map<K,V> map,
CharFunction<? super V> charFunction) |
|
static <K,V,R extends MutableCharCollection> |
collectChar(java.util.Map<K,V> map,
CharFunction<? super V> charFunction,
R target) |
|
static <K,V> MutableDoubleCollection |
collectDouble(java.util.Map<K,V> map,
DoubleFunction<? super V> doubleFunction) |
|
static <K,V,R extends MutableDoubleCollection> |
collectDouble(java.util.Map<K,V> map,
DoubleFunction<? super V> doubleFunction,
R target) |
|
static <K,V> MutableFloatCollection |
collectFloat(java.util.Map<K,V> map,
FloatFunction<? super V> floatFunction) |
|
static <K,V,R extends MutableFloatCollection> |
collectFloat(java.util.Map<K,V> map,
FloatFunction<? super V> floatFunction,
R target) |
|
static <K1,V1,K2,V2> |
collectIf(java.util.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, then
function is applied. |
static <K1,V1,K2,V2> |
collectIf(java.util.Map<K1,V1> map,
Function2<? super K1,? super V1,Pair<K2,V2>> function,
Predicate2<? super K1,? super V1> predicate,
java.util.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, then
function is applied. |
static <K,V> MutableIntCollection |
collectInt(java.util.Map<K,V> map,
IntFunction<? super V> intFunction) |
|
static <K,V,R extends MutableIntCollection> |
collectInt(java.util.Map<K,V> map,
IntFunction<? super V> intFunction,
R target) |
|
static <K,V> MutableLongCollection |
collectLong(java.util.Map<K,V> map,
LongFunction<? super V> longFunction) |
|
static <K,V,R extends MutableLongCollection> |
collectLong(java.util.Map<K,V> map,
LongFunction<? super V> longFunction,
R target) |
|
static <K,V> MutableShortCollection |
collectShort(java.util.Map<K,V> map,
ShortFunction<? super V> shortFunction) |
|
static <K,V,R extends MutableShortCollection> |
collectShort(java.util.Map<K,V> map,
ShortFunction<? super V> shortFunction,
R target) |
|
static <K,V,V2> MutableMap<K,V2> |
collectValues(java.util.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 java.util.Map<K,V2>> |
collectValues(java.util.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> int |
count(java.util.Map<K,V> map,
Predicate<? super V> predicate) |
|
static <K,V> V |
detect(java.util.Map<K,V> map,
Predicate<? super V> predicate) |
|
static <K,V> Pair<K,V> |
detect(java.util.Map<K,V> map,
Predicate2<? super K,? super V> predicate) |
|
static <K,V> V |
detectIfNone(java.util.Map<K,V> map,
Predicate<? super V> predicate,
V ifNone) |
|
static <K,V> java.util.Optional<V> |
detectOptional(java.util.Map<K,V> map,
Predicate<? super V> predicate) |
|
static <K,V> java.util.Optional<Pair<K,V>> |
detectOptional(java.util.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> void |
forEachKey(java.util.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> void |
forEachKeyValue(java.util.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> void |
forEachValue(java.util.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> V |
getIfAbsent(java.util.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 specified
Function0 . |
static <K,V> V |
getIfAbsentDefault(java.util.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 the
defaultValue . |
static <K,V> V |
getIfAbsentPut(java.util.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 specified
Function0 , and put that value in the map at the specified key. |
static <K,V,P> V |
getIfAbsentPutWith(java.util.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 specified
Function with the parameter , and put that value in the map at
the specified key. |
static <K,V,P> V |
getIfAbsentWith(java.util.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 specified
Function with the specified parameter. |
static <K,V,A> A |
ifPresentApply(java.util.Map<K,V> map,
K key,
Function<? super V,? extends A> function) |
If there is a value in the Map tat the specified key, return the result of applying the specified Function
on the value, otherwise return null.
|
static <K,V,IV> IV |
injectInto(IV injectValue,
java.util.Map<K,V> map,
Function2<? super IV,? super V,? extends IV> function) |
|
static <IV,K,V> IV |
injectIntoIf(IV initialValue,
java.util.Map<K,V> map,
Predicate<? super V> predicate,
Function2<? super IV,? super V,? extends IV> function) |
Same as
injectInto(Object, Map, Function2) , but only applies the value to the function
if the predicate returns true for the value. |
static boolean |
isEmpty(java.util.Map<?,?> map) |
A null-safe check on a map to see if it isEmpty.
|
static <K,V> boolean |
noneSatisfy(java.util.Map<K,V> map,
Predicate<? super V> predicate) |
|
static boolean |
notEmpty(java.util.Map<?,?> map) |
A null-safe check on a map to see if it notEmpty.
|
static <K,V> int |
occurrencesOf(java.util.Map<K,V> map,
V object) |
Return the number of occurrences of object in the specified map.
|
static <K,V,A> int |
occurrencesOfAttribute(java.util.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(java.util.Map<K,V> map,
Predicate<? super V> predicate) |
|
static <K,V,R extends java.util.Collection<V>> |
reject(java.util.Map<K,V> map,
Predicate<? super V> predicate,
R targetCollection) |
|
static <K,V> MutableMap<K,V> |
rejectMapOnEntry(java.util.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 java.util.Map<K,V>> |
rejectMapOnEntry(java.util.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(java.util.Map<K,V> map) |
Return a new map swapping key-value for value-key.
|
static <K,V> MutableList<V> |
select(java.util.Map<K,V> map,
Predicate<? super V> predicate) |
|
static <K,V,R extends java.util.Collection<V>> |
select(java.util.Map<K,V> map,
Predicate<? super V> predicate,
R targetCollection) |
|
static <K,V> MutableMap<K,V> |
selectMapOnEntry(java.util.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 java.util.Map<K,V>> |
selectMapOnEntry(java.util.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(java.util.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(java.util.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(java.util.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(java.util.Map<K,V> map,
java.util.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.
|
public static boolean isEmpty(java.util.Map<?,?> map)
true
.public static boolean notEmpty(java.util.Map<?,?> map)
false
.public static <K,V> V getIfAbsentPut(java.util.Map<K,V> map, K key, Function0<? extends V> instanceBlock)
Function0
, and put that value in the map at the specified key.
This method handles the null
-value-at-key case correctly.
public static <K,V,P> V getIfAbsentPutWith(java.util.Map<K,V> map, K key, Function<? super P,? extends V> function, P parameter)
Function
with the parameter
, and put that value in the map at
the specified key.public static <K,V> V getIfAbsent(java.util.Map<K,V> map, K key, Function0<? extends V> instanceBlock)
Function0
.public static <K,V,P> V getIfAbsentWith(java.util.Map<K,V> map, K key, Function<? super P,? extends V> function, P parameter)
Function
with the specified parameter.public static <K,V> V getIfAbsentDefault(java.util.Map<K,V> map, K key, V defaultValue)
defaultValue
.public static <K,V,A> A ifPresentApply(java.util.Map<K,V> map, K key, Function<? super V,? extends A> function)
public static <K,V> MutableList<V> select(java.util.Map<K,V> map, Predicate<? super V> predicate)
Iterate.select(Iterable, Predicate)
public static <K,V,R extends java.util.Collection<V>> R select(java.util.Map<K,V> map, Predicate<? super V> predicate, R targetCollection)
public static <K,V> int count(java.util.Map<K,V> map, Predicate<? super V> predicate)
Iterate.count(Iterable, Predicate)
public static <K,V> MutableMap<K,V> selectMapOnEntry(java.util.Map<K,V> map, Predicate2<? super K,? super V> predicate)
public static <K,V,R extends java.util.Map<K,V>> R selectMapOnEntry(java.util.Map<K,V> map, Predicate2<? super K,? super V> predicate, R target)
public static <K,V> MutableMap<K,V> selectMapOnKey(java.util.Map<K,V> map, Predicate<? super K> predicate)
public static <K,V> MutableMap<K,V> selectMapOnValue(java.util.Map<K,V> map, Predicate<? super V> predicate)
public static <K,V> MutableList<V> reject(java.util.Map<K,V> map, Predicate<? super V> predicate)
Iterate.reject(Iterable, Predicate)
public static <K,V,R extends java.util.Collection<V>> R reject(java.util.Map<K,V> map, Predicate<? super V> predicate, R targetCollection)
public static <K,V> MutableMap<K,V> rejectMapOnEntry(java.util.Map<K,V> map, Predicate2<? super K,? super V> predicate)
public static <K,V,R extends java.util.Map<K,V>> R rejectMapOnEntry(java.util.Map<K,V> map, Predicate2<? super K,? super V> predicate, R target)
public static <K,V> java.util.Collection<K> addAllKeysTo(java.util.Map<K,V> map, java.util.Collection<K> targetCollection)
public static <K,V> java.util.Collection<V> addAllValuesTo(java.util.Map<K,V> map, java.util.Collection<V> targetCollection)
public static <K,V,A> MutableList<A> collect(java.util.Map<K,V> map, Function<? super V,? extends A> function)
Iterate.collect(Iterable, Function)
public static <K,V> MutableBooleanCollection collectBoolean(java.util.Map<K,V> map, BooleanFunction<? super V> booleanFunction)
public static <K,V,R extends MutableBooleanCollection> R collectBoolean(java.util.Map<K,V> map, BooleanFunction<? super V> booleanFunction, R target)
public static <K,V> MutableByteCollection collectByte(java.util.Map<K,V> map, ByteFunction<? super V> byteFunction)
RichIterable.collectByte(ByteFunction)
public static <K,V,R extends MutableByteCollection> R collectByte(java.util.Map<K,V> map, ByteFunction<? super V> byteFunction, R target)
public static <K,V> MutableCharCollection collectChar(java.util.Map<K,V> map, CharFunction<? super V> charFunction)
RichIterable.collectChar(CharFunction)
public static <K,V,R extends MutableCharCollection> R collectChar(java.util.Map<K,V> map, CharFunction<? super V> charFunction, R target)
public static <K,V> MutableDoubleCollection collectDouble(java.util.Map<K,V> map, DoubleFunction<? super V> doubleFunction)
public static <K,V,R extends MutableDoubleCollection> R collectDouble(java.util.Map<K,V> map, DoubleFunction<? super V> doubleFunction, R target)
public static <K,V> MutableFloatCollection collectFloat(java.util.Map<K,V> map, FloatFunction<? super V> floatFunction)
RichIterable.collectFloat(FloatFunction)
public static <K,V,R extends MutableFloatCollection> R collectFloat(java.util.Map<K,V> map, FloatFunction<? super V> floatFunction, R target)
public static <K,V> MutableIntCollection collectInt(java.util.Map<K,V> map, IntFunction<? super V> intFunction)
RichIterable.collectInt(IntFunction)
public static <K,V,R extends MutableIntCollection> R collectInt(java.util.Map<K,V> map, IntFunction<? super V> intFunction, R target)
public static <K,V> MutableLongCollection collectLong(java.util.Map<K,V> map, LongFunction<? super V> longFunction)
RichIterable.collectLong(LongFunction)
public static <K,V,R extends MutableLongCollection> R collectLong(java.util.Map<K,V> map, LongFunction<? super V> longFunction, R target)
public static <K,V> MutableShortCollection collectShort(java.util.Map<K,V> map, ShortFunction<? super V> shortFunction)
RichIterable.collectShort(ShortFunction)
public static <K,V,R extends MutableShortCollection> R collectShort(java.util.Map<K,V> map, ShortFunction<? super V> shortFunction, R target)
public static <K,V,K2,V2> MutableMap<K2,V2> collect(java.util.Map<K,V> map, Function2<? super K,? super V,Pair<K2,V2>> function)
public static <K1,V1,K2,V2,R extends java.util.Map<K2,V2>> R collect(java.util.Map<K1,V1> map, Function2<? super K1,? super V1,Pair<K2,V2>> function, R target)
public static <K,V,V2> MutableMap<K,V2> collectValues(java.util.Map<K,V> map, Function2<? super K,? super V,? extends V2> function)
public static <K,V,V2,R extends java.util.Map<K,V2>> R collectValues(java.util.Map<K,V> map, Function2<? super K,? super V,? extends V2> function, R target)
public static <K1,V1,K2,V2> MutableMap<K2,V2> collectIf(java.util.Map<K1,V1> map, Function2<? super K1,? super V1,Pair<K2,V2>> function, Predicate2<? super K1,? super V1> predicate)
function
is applied.
The results of these evaluations are collected into a new map.public static <K1,V1,K2,V2> MutableMap<K2,V2> collectIf(java.util.Map<K1,V1> map, Function2<? super K1,? super V1,Pair<K2,V2>> function, Predicate2<? super K1,? super V1> predicate, java.util.Map<K2,V2> target)
function
is applied.
The results of these evaluations are collected into the target map.public static <K1,V1,K2,V2> MutableMap<K2,V2> collect(java.util.Map<K1,V1> map, Function<? super K1,? extends K2> keyFunction, Function<? super V1,? extends V2> valueFunction)
public static <K1,V1,K2,V2> MutableMap<K2,V2> collect(java.util.Map<K1,V1> map, Function<? super K1,? extends K2> keyFunction, Function<? super V1,? extends V2> valueFunction, java.util.Map<K2,V2> target)
public static <K,V,A,R extends java.util.Collection<A>> R collect(java.util.Map<K,V> map, Function<? super V,? extends A> function, R targetCollection)
public static <K,V> void forEachValue(java.util.Map<K,V> map, Procedure<? super V> procedure)
procedure
is evaluated with the value as the parameter.public static <K,V> void forEachKey(java.util.Map<K,V> map, Procedure<? super K> procedure)
procedure
is evaluated with the key as the parameter.public static <K,V> void forEachKeyValue(java.util.Map<K,V> map, Procedure2<? super K,? super V> procedure)
procedure
is evaluated with the element as the parameter.public static <K,V> MutableMap<V,K> flipUniqueValues(MapIterable<K,V> mapIterable)
MapIterable.flipUniqueValues()
public static <K,V> Pair<K,V> detect(java.util.Map<K,V> map, Predicate2<? super K,? super V> predicate)
public static <K,V> V detect(java.util.Map<K,V> map, Predicate<? super V> predicate)
Iterate.detect(Iterable, Predicate)
public static <K,V> java.util.Optional<Pair<K,V>> detectOptional(java.util.Map<K,V> map, Predicate2<? super K,? super V> predicate)
public static <K,V> java.util.Optional<V> detectOptional(java.util.Map<K,V> map, Predicate<? super V> predicate)
public static <K,V> V detectIfNone(java.util.Map<K,V> map, Predicate<? super V> predicate, V ifNone)
public static <K,V,IV> IV injectInto(IV injectValue, java.util.Map<K,V> map, Function2<? super IV,? super V,? extends IV> function)
public static <IV,K,V> IV injectIntoIf(IV initialValue, java.util.Map<K,V> map, Predicate<? super V> predicate, Function2<? super IV,? super V,? extends IV> function)
injectInto(Object, Map, Function2)
, but only applies the value to the function
if the predicate returns true for the value.injectInto(Object, Map, Function2)
public static <K,V> boolean anySatisfy(java.util.Map<K,V> map, Predicate<? super V> predicate)
Iterate.anySatisfy(Iterable, Predicate)
public static <K,V> boolean allSatisfy(java.util.Map<K,V> map, Predicate<? super V> predicate)
Iterate.allSatisfy(Iterable, Predicate)
public static <K,V> boolean noneSatisfy(java.util.Map<K,V> map, Predicate<? super V> predicate)
Iterate.noneSatisfy(Iterable, Predicate)
public static <K,V> MutableList<Pair<K,V>> toListOfPairs(java.util.Map<K,V> map)
public static <K,V> MutableList<V> toSortedList(java.util.Map<K,V> map, java.util.Comparator<? super V> comparator)
public static <K,V> MutableMap<V,K> reverseMapping(java.util.Map<K,V> map)
public static <K,V> int occurrencesOf(java.util.Map<K,V> map, V object)
public static <K,V,A> int occurrencesOfAttribute(java.util.Map<K,V> map, Function<? super V,? extends A> function, A object)
public static <K,V> MutableSetMultimap<V,K> flip(MapIterable<K,V> iMap)
public static <K,V> MutableSortedSetMultimap<V,K> flip(SortedMapIterable<K,V> iMap)
Copyright © 2004–2018. All rights reserved.