Iterable<K>, Map<K,V>, InternalIterable<K>, MapIterable<K,V>, MutableMapIterable<K,V>, RichIterable<K>SynchronizedBiMap, SynchronizedMutableMap, SynchronizedSortedMappublic abstract class AbstractSynchronizedMapIterable<K,V> extends AbstractSynchronizedRichIterable<V> implements MutableMapIterable<K,V>
| Modifier and Type | Method | Description |
|---|---|---|
V |
add(Pair<K,V> keyValuePair) |
This method allows mutable map the ability to add an element in the form of Pair
|
<KK,VV> MutableMap<KK,VV> |
aggregateBy(Function<? super V,? extends KK> groupBy,
Function0<? extends VV> zeroValueFactory,
Function2<? super VV,? super V,? extends VV> nonMutatingAggregator) |
Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function.
|
<KK,VV> MutableMap<KK,VV> |
aggregateInPlaceBy(Function<? super V,? extends KK> groupBy,
Function0<? extends VV> zeroValueFactory,
Procedure2<? super VV,? super V> mutatingAggregator) |
Applies an aggregate procedure over the iterable grouping results into a Map based on the specific groupBy function.
|
void |
clear() |
|
boolean |
containsKey(Object key) |
|
boolean |
containsValue(Object value) |
|
Pair<K,V> |
detect(Predicate2<? super K,? super V> predicate) |
Return the first key and value of the map for which the predicate evaluates to true when they are given
as arguments.
|
Optional<Pair<K,V>> |
detectOptional(Predicate2<? super K,? super V> predicate) |
Return the first key and value of the map as an Optional for which the predicate evaluates to true when
they are given as arguments.
|
void |
forEachKey(Procedure<? super K> procedure) |
Calls the
procedure with each key of the map. |
void |
forEachKeyValue(Procedure2<? super K,? super V> procedure2) |
Calls the
procedure with each key-value pair of the map. |
void |
forEachValue(Procedure<? super V> procedure) |
Calls the procedure with each value of the map.
|
V |
get(Object key) |
|
V |
getIfAbsent(K key,
Function0<? extends V> function) |
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.
|
V |
getIfAbsentPut(K key,
Function0<? extends V> function) |
Get and return the value in the Map at the specified key.
|
V |
getIfAbsentPut(K key,
V value) |
Get and return the value in the Map at the specified key.
|
<P> V |
getIfAbsentPutWith(K key,
Function<? super P,? extends V> function,
P parameter) |
Get and return the value in the Map at the specified key.
|
V |
getIfAbsentPutWithKey(K key,
Function<? super K,? extends V> function) |
Get and return the value in the Map at the specified key.
|
V |
getIfAbsentValue(K key,
V value) |
Return the value in the Map that corresponds to the specified key, or if there is no value at the key, return
value. |
<P> V |
getIfAbsentWith(K key,
Function<? super P,? extends V> function,
P parameter) |
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 and parameter.
|
<VV> MutableMapIterable<VV,V> |
groupByUniqueKey(Function<? super V,? extends VV> function) |
For each element of the iterable, the function is evaluated and he results of these evaluations are collected
into a new map, where the transformed value is the key.
|
<A> A |
ifPresentApply(K key,
Function<? super V,? extends A> function) |
If there is a value in the Map that corresponds to the specified key return the result of applying the specified
Function on the value, otherwise return null.
|
RichIterable<Pair<K,V>> |
keyValuesView() |
Returns an unmodifiable lazy iterable of key/value pairs wrapped around the entrySet for the map.
|
V |
put(K key,
V value) |
|
void |
putAll(Map<? extends K,? extends V> map) |
|
V |
remove(Object key) |
|
V |
removeKey(K key) |
Remove an entry from the map at the specified
key. |
<V1> MutableObjectDoubleMap<V1> |
sumByDouble(Function<? super V,? extends V1> groupBy,
DoubleFunction<? super V> function) |
Groups and sums the values using the two specified functions.
|
<V1> MutableObjectDoubleMap<V1> |
sumByFloat(Function<? super V,? extends V1> groupBy,
FloatFunction<? super V> function) |
Groups and sums the values using the two specified functions.
|
<V1> MutableObjectLongMap<V1> |
sumByInt(Function<? super V,? extends V1> groupBy,
IntFunction<? super V> function) |
Groups and sums the values using the two specified functions.
|
<V1> MutableObjectLongMap<V1> |
sumByLong(Function<? super V,? extends V1> groupBy,
LongFunction<? super V> function) |
Groups and sums the values using the two specified functions.
|
V |
updateValue(K key,
Function0<? extends V> factory,
Function<? super V,? extends V> function) |
Looks up the value associated with
key, applies the function to it, and replaces the value. |
<P> V |
updateValueWith(K key,
Function0<? extends V> factory,
Function2<? super V,? super P,? extends V> function,
P parameter) |
Same as
MutableMapIterable.updateValue(Object, Function0, Function) with a Function2 and specified parameter which is
passed to the function. |
allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, equals, flatCollect, forEach, forEachWith, forEachWithIndex, getFirst, getLast, getOnly, groupBy, groupByEach, groupByUniqueKey, hashCode, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, iterator, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, reject, rejectWith, select, selectWith, size, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndexforEach, forEachWith, forEachWithIndexforEach, iterator, spliteratorcompute, computeIfAbsent, computeIfPresent, entry, entrySet, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, of, of, of, of, of, of, of, of, of, of, of, ofEntries, putIfAbsent, remove, replace, replace, replaceAll, size, valuesequals, hashCode, keysView, toString, valuesViewasSynchronized, asUnmodifiable, collect, collectValues, flip, flipUniqueValues, groupBy, groupByEach, newEmpty, partition, reject, reject, rejectWith, select, select, selectInstancesOf, selectWith, tap, toImmutable, withAllKeyValueArguments, withAllKeyValues, withKeyValue, withoutAllKeys, withoutKey, zip, zipWithIndexgetClass, hashCode, notify, notifyAll, wait, wait, waitallSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collect, collectBoolean, collectBoolean, collectByte, collectByte, collectChar, collectChar, collectDouble, collectDouble, collectFloat, collectFloat, collectIf, collectIf, collectInt, collectInt, collectLong, collectLong, collectShort, collectShort, collectWith, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollect, getFirst, getLast, getOnly, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, partitionWith, reduce, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, size, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndexpublic V get(Object key)
get in interface Map<K,V>get in interface MapIterable<K,V>Map.get(Object)public V getIfAbsent(K key, Function0<? extends V> function)
MapIterablegetIfAbsent in interface MapIterable<K,V>public V getIfAbsentValue(K key, V value)
MapIterablevalue.getIfAbsentValue in interface MapIterable<K,V>public <P> V getIfAbsentWith(K key, Function<? super P,? extends V> function, P parameter)
MapIterablegetIfAbsentWith in interface MapIterable<K,V>public <A> A ifPresentApply(K key, Function<? super V,? extends A> function)
MapIterableifPresentApply in interface MapIterable<K,V>public boolean containsKey(Object key)
containsKey in interface Map<K,V>containsKey in interface MapIterable<K,V>Map.containsKey(Object)public boolean containsValue(Object value)
containsValue in interface Map<K,V>containsValue in interface MapIterable<K,V>Map.containsValue(Object)public void forEachValue(Procedure<? super V> procedure)
MapIterable
Set<String> result = UnifiedSet.newSet();
MutableMap<Integer, String> map = this.newMapWithKeysValues(1, "One", 2, "Two", 3, "Three", 4, "Four");
map.forEachValue(new CollectionAddProcedure<String>(result));
Verify.assertSetsEqual(UnifiedSet.newSetWith("One", "Two", "Three", "Four"), result);
forEachValue in interface MapIterable<K,V>public void forEachKey(Procedure<? super K> procedure)
MapIterableprocedure with each key of the map.
final Collection<Integer> result = new ArrayList<Integer>();
MutableMap<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "2", 3, "3");
map.forEachKey(new CollectionAddProcedure<Integer>(result));
Verify.assertContainsAll(result, 1, 2, 3);
forEachKey in interface MapIterable<K,V>public void forEachKeyValue(Procedure2<? super K,? super V> procedure2)
MapIterableprocedure with each key-value pair of the map.
final Collection<String> collection = new ArrayList<String>();
MutableMap<Integer, String> map = this.newMapWithKeysValues(1, "One", 2, "Two", 3, "Three");
map.forEachKeyValue((Integer key, String value) -> collection.add(String.valueOf(key) + value));
Verify.assertContainsAll(collection, "1One", "2Two", "3Three");
forEachKeyValue in interface MapIterable<K,V>public Pair<K,V> detect(Predicate2<? super K,? super V> predicate)
MapIterable
Pair<City, Person> detected =
peopleByCity.detect((City city, Person person) -> city.getName().equals("Anytown") && person.getLastName().equals("Smith"));
detect in interface MapIterable<K,V>public Optional<Pair<K,V>> detectOptional(Predicate2<? super K,? super V> predicate)
MapIterable
Optional<Pair<City, Person>> detected =
peopleByCity.detectOptional((city, person)
-> city.getName().equals("Anytown") && person.getLastName().equals("Smith"));
detectOptional in interface MapIterable<K,V>public V getIfAbsentPut(K key, Function0<? extends V> function)
MutableMapIterablegetIfAbsentPut in interface MutableMapIterable<K,V>public V getIfAbsentPut(K key, V value)
MutableMapIterablegetIfAbsentPut in interface MutableMapIterable<K,V>public V getIfAbsentPutWithKey(K key, Function<? super K,? extends V> function)
MutableMapIterablegetIfAbsentPutWithKey in interface MutableMapIterable<K,V>public <P> V getIfAbsentPutWith(K key, Function<? super P,? extends V> function, P parameter)
MutableMapIterablegetIfAbsentPutWith in interface MutableMapIterable<K,V>public V removeKey(K key)
MutableMapIterablekey.removeKey in interface MutableMapIterable<K,V>Map.remove(Object)public V add(Pair<K,V> keyValuePair)
MutableMapIterableadd in interface MutableMapIterable<K,V>Map.put(Object, Object)public V updateValue(K key, Function0<? extends V> factory, Function<? super V,? extends V> function)
MutableMapIterablekey, applies the function to it, and replaces the value. If there
is no value associated with key, starts it off with a value supplied by factory.updateValue in interface MutableMapIterable<K,V>public <P> V updateValueWith(K key, Function0<? extends V> factory, Function2<? super V,? super P,? extends V> function, P parameter)
MutableMapIterableMutableMapIterable.updateValue(Object, Function0, Function) with a Function2 and specified parameter which is
passed to the function.updateValueWith in interface MutableMapIterable<K,V>public <VV> MutableMapIterable<VV,V> groupByUniqueKey(Function<? super V,? extends VV> function)
RichIterablegroupByUniqueKey in interface MutableMapIterable<K,V>groupByUniqueKey in interface RichIterable<K>groupByUniqueKey in class AbstractSynchronizedRichIterable<V>RichIterable.groupBy(Function)public <KK,VV> MutableMap<KK,VV> aggregateInPlaceBy(Function<? super V,? extends KK> groupBy, Function0<? extends VV> zeroValueFactory, Procedure2<? super VV,? super V> mutatingAggregator)
RichIterableaggregateInPlaceBy in interface MutableMapIterable<K,V>aggregateInPlaceBy in interface RichIterable<K>public <KK,VV> MutableMap<KK,VV> aggregateBy(Function<? super V,? extends KK> groupBy, Function0<? extends VV> zeroValueFactory, Function2<? super VV,? super V,? extends VV> nonMutatingAggregator)
RichIterableaggregateBy in interface MutableMapIterable<K,V>aggregateBy in interface RichIterable<K>public RichIterable<Pair<K,V>> keyValuesView()
MapIterablekeyValuesView in interface MapIterable<K,V>public <V1> MutableObjectLongMap<V1> sumByInt(Function<? super V,? extends V1> groupBy, IntFunction<? super V> function)
RichIterablesumByInt in interface MutableMapIterable<K,V>sumByInt in interface RichIterable<K>public <V1> MutableObjectDoubleMap<V1> sumByFloat(Function<? super V,? extends V1> groupBy, FloatFunction<? super V> function)
RichIterablesumByFloat in interface MutableMapIterable<K,V>sumByFloat in interface RichIterable<K>public <V1> MutableObjectLongMap<V1> sumByLong(Function<? super V,? extends V1> groupBy, LongFunction<? super V> function)
RichIterablesumByLong in interface MutableMapIterable<K,V>sumByLong in interface RichIterable<K>public <V1> MutableObjectDoubleMap<V1> sumByDouble(Function<? super V,? extends V1> groupBy, DoubleFunction<? super V> function)
RichIterablesumByDouble in interface MutableMapIterable<K,V>sumByDouble in interface RichIterable<K>Copyright © 2004–2017. All rights reserved.