Top Description Fields Constructors Methods
org.eclipse.collections.impl.map

public abstract Class AbstractSynchronizedMapIterable<K, V>

extends AbstractSynchronizedRichIterable<V>
implements MutableMapIterable<K, V>
Class Inheritance
All Implemented Interfaces
org.eclipse.collections.api.map.MutableMapIterable, java.util.Map, org.eclipse.collections.api.map.MapIterable, org.eclipse.collections.api.RichIterable, org.eclipse.collections.api.InternalIterable, java.lang.Iterable
Known Direct Subclasses
org.eclipse.collections.impl.map.mutable.SynchronizedMutableMap, org.eclipse.collections.impl.map.sorted.mutable.SynchronizedSortedMap, org.eclipse.collections.impl.bimap.mutable.SynchronizedBiMap
Imports
java.util.Map, .Optional, .Set, java.util.function.BiFunction, org.eclipse.collections.api.RichIterable, org.eclipse.collections.api.bag.MutableBag, org.eclipse.collections.api.block.function.Function, .Function0, .Function2, org.eclipse.collections.api.block.function.primitive.DoubleFunction, .FloatFunction, .IntFunction, .LongFunction, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.procedure.Procedure, .Procedure2, org.eclipse.collections.api.collection.MutableCollection, org.eclipse.collections.api.map.MutableMapIterable, org.eclipse.collections.api.map.primitive.MutableObjectDoubleMap, .MutableObjectLongMap, org.eclipse.collections.api.multimap.MutableMultimap, org.eclipse.collections.api.partition.PartitionMutableCollection, org.eclipse.collections.api.tuple.Pair, org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable, org.eclipse.collections.impl.tuple.AbstractImmutableEntry, org.eclipse.collections.impl.utility.LazyIterate

A synchronized view of a map.

Field Summary

Inherited from org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable:
delegatelock

Constructor Summary

AccessConstructor and Description
protected
protected

Method Summary

Modifier and TypeMethod and Description
public V
add(Pair<? extends K, ? extends V> keyValuePair)

Overrides default org.eclipse.collections.api.map.MutableMapIterable.add.

This method allows mutable map the ability to add an element in the form of Pair<?

public <KK, VV> MutableMapIterable<KK, VV>
aggregateBy(Function<? super V, ? extends KK> groupBy, Function0<? extends VV> zeroValueFactory, Function2<? super VV, ? super V, ? extends VV> nonMutatingAggregator)

Overrides org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable.aggregateBy.

Overrides default org.eclipse.collections.api.map.MutableMapIterable.aggregateBy, org.eclipse.collections.api.RichIterable.aggregateBy.

Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function.

public <K1, V1, V2> MutableMapIterable<K1, V2>
aggregateBy(Function<? super K, ? extends K1> keyFunction, Function<? super V, ? extends V1> valueFunction, Function0<? extends V2> zeroValueFactory, Function2<? super V2, ? super V1, ? extends V2> nonMutatingAggregator)

Overrides default org.eclipse.collections.api.map.MutableMapIterable.aggregateBy.

Applies an aggregate function over the map grouping results into a map based on the specific key and value groupBy functions.

public <KK, VV> MutableMapIterable<KK, VV>
aggregateInPlaceBy(Function<? super V, ? extends KK> groupBy, Function0<? extends VV> zeroValueFactory, Procedure2<? super VV, ? super V> mutatingAggregator)

Overrides org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable.aggregateInPlaceBy.

Overrides default org.eclipse.collections.api.map.MutableMapIterable.aggregateInPlaceBy, org.eclipse.collections.api.RichIterable.aggregateInPlaceBy.

Applies an aggregate procedure over the iterable grouping results into a Map based on the specific groupBy function.

public void
clear()

Implements java.util.Map.clear.

Removes all of the mappings from this map (optional operation).

public boolean
containsKey(Object key)

Implements org.eclipse.collections.api.map.MapIterable.containsKey, java.util.Map.containsKey.

Returns true if this map contains a mapping for the specified key.

public boolean
containsValue(Object value)

Implements org.eclipse.collections.api.map.MapIterable.containsValue, java.util.Map.containsValue.

Returns true if this map maps one or more keys to the specified value.

public <V1> MutableBag<V1>
countBy(Function<? super V, ? extends V1> function)

Overrides org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable.countBy.

Overrides default org.eclipse.collections.api.map.MutableMapIterable.countBy, org.eclipse.collections.api.RichIterable.countBy.

This method will count the number of occurrences of each value calculated by applying the function to each element of the collection.

public <V1> MutableBag<V1>
countByEach(Function<? super V, ? extends Iterable<V1>> function)

Overrides org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable.countByEach.

Overrides default org.eclipse.collections.api.map.MutableMapIterable.countByEach, org.eclipse.collections.api.RichIterable.countByEach.

This method will count the number of occurrences of each value calculated by applying the function to each element of the collection.

public <V1, P> MutableBag<V1>
countByWith(Function2<? super V, ? super P, ? extends V1> function, P parameter)

Overrides org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable.countByWith.

Overrides default org.eclipse.collections.api.map.MutableMapIterable.countByWith, org.eclipse.collections.api.RichIterable.countByWith.

This method will count the number of occurrences of each value calculated by applying the function to each element of the collection with the specified parameter as the second argument.

public Pair<K, V>
detect(Predicate2<? super K, ? super V> predicate)

Implements org.eclipse.collections.api.map.MapIterable.detect.

Return the first key and value of the map for which the predicate evaluates to true when they are given as arguments.

public Optional<Pair<K, V>>
detectOptional(Predicate2<? super K, ? super V> predicate)

Implements org.eclipse.collections.api.map.MapIterable.detectOptional.

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.

public void
forEachKey(Procedure<? super K> procedure)

Implements org.eclipse.collections.api.map.MapIterable.forEachKey.

Calls the procedure with each key of the map.

public void
forEachKeyValue(Procedure2<? super K, ? super V> procedure2)

Implements org.eclipse.collections.api.map.MapIterable.forEachKeyValue.

Calls the procedure with each key-value pair of the map.

public void
forEachValue(Procedure<? super V> procedure)

Implements org.eclipse.collections.api.map.MapIterable.forEachValue.

Calls the procedure with each value of the map.

public V
get(Object key)

Implements org.eclipse.collections.api.map.MapIterable.get, java.util.Map.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

protected MutableMapIterable<K, V>
public V
getIfAbsent(K key, Function0<? extends V> function)

Implements org.eclipse.collections.api.map.MapIterable.getIfAbsent.

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.

public V
getIfAbsentPut(K key, Function0<? extends V> function)

Implements org.eclipse.collections.api.map.MutableMapIterable.getIfAbsentPut, org.eclipse.collections.api.map.MutableMapIterable.getIfAbsentPut.

Get and return the value in the Map at the specified key.

public V
getIfAbsentPut(K key, V value)

Implements org.eclipse.collections.api.map.MutableMapIterable.getIfAbsentPut.

Get and return the value in the Map at the specified key.

public <P> V
getIfAbsentPutWith(K key, Function<? super P, ? extends V> function, P parameter)

Implements org.eclipse.collections.api.map.MutableMapIterable.getIfAbsentPutWith.

Get and return the value in the Map at the specified key.

public V
getIfAbsentPutWithKey(K key, Function<? super K, ? extends V> function)

Implements org.eclipse.collections.api.map.MutableMapIterable.getIfAbsentPutWithKey.

Get and return the value in the Map at the specified key.

public V
getIfAbsentValue(K key, V value)

Implements org.eclipse.collections.api.map.MapIterable.getIfAbsentValue.

Return the value in the Map that corresponds to the specified key, or if there is no value at the key, return value.

public <P> V
getIfAbsentWith(K key, Function<? super P, ? extends V> function, P parameter)

Implements org.eclipse.collections.api.map.MapIterable.getIfAbsentWith.

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.

public <V1> MutableMultimap<V1, V>
groupBy(Function<? super V, ? extends V1> function)

Overrides org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable.groupBy.

Implements org.eclipse.collections.api.map.MutableMapIterable.groupBy, org.eclipse.collections.api.RichIterable.groupBy.

For each element of the iterable, the function is evaluated and the results of these evaluations are collected into a new multimap, where the transformed value is the key and the original values are added to the same (or similar) species of collection as the source iterable.

public <V1> MutableMultimap<V1, V>
groupByEach(Function<? super V, ? extends Iterable<V1>> function)

Overrides org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable.groupByEach.

Implements org.eclipse.collections.api.map.MutableMapIterable.groupByEach, org.eclipse.collections.api.RichIterable.groupByEach.

Similar to groupBy(Function), except the result of evaluating function will return a collection of keys for each value.

public <VV> MutableMapIterable<VV, V>
groupByUniqueKey(Function<? super V, ? extends VV> function)

Overrides org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable.groupByUniqueKey.

Implements org.eclipse.collections.api.map.MutableMapIterable.groupByUniqueKey, org.eclipse.collections.api.RichIterable.groupByUniqueKey.

For each element of the iterable, the function is evaluated, and the results of these evaluations are collected into a new map, where the transformed value is the key.

public <A> A
ifPresentApply(K key, Function<? super V, ? extends A> function)

Implements org.eclipse.collections.api.map.MapIterable.ifPresentApply.

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.

public RichIterable<K>
keysView()

Implements org.eclipse.collections.api.map.MapIterable.keysView.

Returns an unmodifiable lazy iterable wrapped around the keySet for the map.

public RichIterable<Pair<K, V>>
keyValuesView()

Implements org.eclipse.collections.api.map.MapIterable.keyValuesView.

Returns an unmodifiable lazy iterable of key/value pairs wrapped around the entrySet for the map.

public V
merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction)

Overrides default java.util.Map.merge.

If the specified key is not already associated with a value or is associated with null, associates it with the given non-null value (optional operation).

public PartitionMutableCollection<V>
partition(Predicate<? super V> predicate)

Overrides org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable.partition.

Implements org.eclipse.collections.api.map.MutableMapIterable.partition, org.eclipse.collections.api.RichIterable.partition.

Filters a collection into a PartitionedIterable based on the evaluation of the predicate.

public V
put(K key, V value)

Implements java.util.Map.put.

Associates the specified value with the specified key in this map (optional operation).

public void
putAll(Map<? extends K, ? extends V> map)

Implements java.util.Map.putAll.

Copies all of the mappings from the specified map to this map (optional operation).

public V
putPair(Pair<? extends K, ? extends V> keyValuePair)

Overrides default org.eclipse.collections.api.map.MutableMapIterable.putPair.

This method allows mutable map the ability to add an element in the form of Pair<?

public <KK> MutableMapIterable<KK, V>
reduceBy(Function<? super V, ? extends KK> groupBy, Function2<? super V, ? super V, ? extends V> reduceFunction)

Overrides org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable.reduceBy.

Overrides default org.eclipse.collections.api.map.MutableMapIterable.reduceBy, org.eclipse.collections.api.RichIterable.reduceBy.

Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function.

public MutableCollection<V>
reject(Predicate<? super V> predicate)

Overrides org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable.reject.

Implements org.eclipse.collections.api.map.MutableMapIterable.reject, org.eclipse.collections.api.RichIterable.reject.

Returns all elements of the source collection that return false when evaluating of the predicate.

public <P> MutableCollection<V>
public V
remove(Object key)

Implements java.util.Map.remove.

Removes the mapping for a key from this map if it is present (optional operation).

public boolean
removeAllKeys(Set<? extends K> keys)

Overrides default org.eclipse.collections.api.map.MutableMapIterable.removeAllKeys.

Remove entries from the map at the specified keys.

public boolean
removeIf(Predicate2<? super K, ? super V> predicate)

Overrides default org.eclipse.collections.api.map.MutableMapIterable.removeIf.

Remove an entry from the map if the predicate evaluates to true.

public V
removeKey(K key)

Implements org.eclipse.collections.api.map.MutableMapIterable.removeKey.

Remove an entry from the map at the specified key.

public MutableCollection<V>
select(Predicate<? super V> predicate)

Overrides org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable.select.

Implements org.eclipse.collections.api.map.MutableMapIterable.select, org.eclipse.collections.api.RichIterable.select.

Returns all elements of the source collection that return true when evaluating the predicate.

public <S> MutableCollection<S>
public <P> MutableCollection<V>
public <V1> MutableObjectDoubleMap<V1>
public <V1> MutableObjectDoubleMap<V1>
public <V1> MutableObjectLongMap<V1>
sumByInt(Function<? super V, ? extends V1> groupBy, IntFunction<? super V> function)

Overrides org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable.sumByInt.

Implements org.eclipse.collections.api.map.MutableMapIterable.sumByInt, org.eclipse.collections.api.RichIterable.sumByInt.

Groups and sums the values using the two specified functions.

public <V1> MutableObjectLongMap<V1>
public MutableMapIterable<K, V>
public V
updateValue(K key, Function0<? extends V> factory, Function<? super V, ? extends V> function)

Implements org.eclipse.collections.api.map.MutableMapIterable.updateValue.

Looks up the value associated with key, applies the function to it, and replaces the value.

public <P> V
updateValueWith(K key, Function0<? extends V> factory, Function2<? super V, ? super P, ? extends V> function, P parameter)

Implements org.eclipse.collections.api.map.MutableMapIterable.updateValueWith.

Same as updateValue(Object, Function0, Function) with a Function2 and specified parameter which is passed to the function.

public RichIterable<V>
valuesView()

Implements org.eclipse.collections.api.map.MapIterable.valuesView.

Returns an unmodifiable lazy iterable wrapped around the values for the map.

public <S> MutableCollection<Pair<V, S>>
zip(Iterable<S> that)

Overrides org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable.zip.

Implements org.eclipse.collections.api.map.MutableMapIterable.zip, org.eclipse.collections.api.RichIterable.zip.

Returns a RichIterable formed from this RichIterable and another RichIterable by combining corresponding elements in pairs.

public MutableCollection<Pair<V, Integer>>
Inherited from org.eclipse.collections.impl.collection.AbstractSynchronizedRichIterable:
allSatisfyallSatisfyWithanySatisfyanySatisfyWithappendStringappendStringappendStringasLazychunkcollectcollectcollectBooleancollectBooleancollectBytecollectBytecollectCharcollectCharcollectDoublecollectDoublecollectFloatcollectFloatcollectIfcollectIfcollectIntcollectIntcollectLongcollectLongcollectShortcollectShortcollectWithcollectWithcontainscontainsAllcontainsAllArgumentscontainsAllIterablecontainsAnycontainsAnyIterablecontainsNonecontainsNoneIterablecountcountBycountByEachcountByWithcountWithdetectdetectIfNonedetectOptionaldetectWithdetectWithIfNonedetectWithOptionaleachequalsflatCollectflatCollectflatCollectBooleanflatCollectByteflatCollectCharflatCollectDoubleflatCollectFloatflatCollectIntflatCollectLongflatCollectShortforEachWithforEachWithIndexgetFirstgetLastgetLockgetOnlygroupBygroupByEachgroupByUniqueKeyhashCodeinjectIntoinjectIntoinjectIntoinjectIntoinjectIntointoisEmptyiteratormakeStringmakeStringmakeStringmakeStringmaxmaxmaxBymaxByOptionalmaxOptionalmaxOptionalminminminByminByOptionalminOptionalminOptionalnoneSatisfynoneSatisfyWithnotEmptypartitionWithrejectrejectWithselectselectWithsizesumOfDoublesumOfFloatsumOfIntsumOfLongtoArraytoArraytoBagtoBiMaptoImmutableBagtoImmutableListtoImmutableSettoImmutableSortedBagtoImmutableSortedBagtoImmutableSortedBagBytoImmutableSortedListtoImmutableSortedListtoImmutableSortedSettoImmutableSortedSettoImmutableSortedSetBytoListtoMaptoMaptoSettoSortedBagtoSortedBagtoSortedListtoSortedListtoSortedListBytoSortedMaptoSortedMaptoSortedMapBytoSortedSettoSortedSettoStringzipzipWithIndex