Top Methods
org.eclipse.collections.api.map

public Interface MutableMapIterable<K, V>

extends MapIterable<K, V>, Map<K, V>
Known Direct Subinterfaces
org.eclipse.collections.api.map.MutableOrderedMap, org.eclipse.collections.api.map.sorted.MutableSortedMap, org.eclipse.collections.api.bimap.MutableBiMap, org.eclipse.collections.api.map.MutableMap
Imports
java.util.Map, .Objects, .Set, java.util.function.BiConsumer, 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.factory.Maps, 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

Since
6.0

Method Summary

Modifier and TypeMethod and Description
public default V

Returns:

previous value in the map for the key, or null if no value exists for the key.
add
(Pair<? extends K, ? extends V> keyValuePair)

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

public default <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 default 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 default <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.MapIterable.aggregateBy.

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

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

Overrides default 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 MutableMapIterable<K, V>
asSynchronized()

Returns a synchronized wrapper backed by this map.

public MutableMapIterable<K, V>

Returns:

an unmodifiable view of this map.
asUnmodifiable
()

Returns an unmodifiable view of this map.

public <K2, V2> MutableMapIterable<K2, V2>
collect(Function2<? super K, ? super V, Pair<K2, V2>> function)

Redeclares org.eclipse.collections.api.map.MapIterable.collect.

For each key and value of the map the function is evaluated.

public <R> MutableMapIterable<R, V>
collectKeysUnique(Function2<? super K, ? super V, ? extends R> function)

Redeclares org.eclipse.collections.api.map.MapIterable.collectKeysUnique.

For each key and value of the map the function is evaluated.

public <R> MutableMapIterable<K, R>
collectValues(Function2<? super K, ? super V, ? extends R> function)

Redeclares org.eclipse.collections.api.map.MapIterable.collectValues.

For each key and value of the map the function is evaluated.

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

Overrides default 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 default <V1> MutableBag<V1>
countByEach(Function<? super V, ? extends Iterable<V1>> function)

Overrides default 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 default <V1, P> MutableBag<V1>
countByWith(Function2<? super V, ? super P, ? extends V1> function, P parameter)

Overrides default 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 MutableMultimap<V, K>
flip()

Redeclares org.eclipse.collections.api.map.MapIterable.flip.

Given a map from Domain -> Range return a multimap from Range -> Domain.

public MutableMapIterable<V, K>
flipUniqueValues()

Redeclares org.eclipse.collections.api.map.MapIterable.flipUniqueValues.

Return the MapIterable that is obtained by flipping the direction of this map and making the associations from value to key.

public default void
forEach(BiConsumer<? super K, ? super V> action)

Overrides default org.eclipse.collections.api.map.MapIterable.forEach, java.util.Map.forEach.

Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.

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

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

public V
getIfAbsentPut(K key, V value)

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)

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

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

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

public default V
getOrDefault(Object key, V defaultValue)

Overrides default org.eclipse.collections.api.map.MapIterable.getOrDefault, java.util.Map.getOrDefault.

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

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

Redeclares 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)

Redeclares 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 <V1> MutableMapIterable<V1, V>
groupByUniqueKey(Function<? super V, ? extends V1> function)

Redeclares 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 MutableMapIterable<K, V>
newEmpty()

Creates a new instance of the same type, using the default capacity and growth parameters.

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

Redeclares org.eclipse.collections.api.RichIterable.partition.

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

public default void
putAllMapIterable(MapIterable<? extends K, ? extends V> mapIterable)

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

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

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

Overrides default 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 MutableMapIterable<K, V>
reject(Predicate2<? super K, ? super V> predicate)

Redeclares org.eclipse.collections.api.map.MapIterable.reject.

For each key and value of the map the predicate is evaluated, if the result of the evaluation is false, that key and value are returned in a new map.

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

Redeclares 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>
rejectWith(Predicate2<? super V, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.RichIterable.rejectWith.

Similar to reject(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

public default boolean

Returns:

true if this map changed as a result of the call
removeAllKeys
(Set<? extends K> keys)

Remove entries from the map at the specified keys.

public default boolean

Returns:

true if any entry is removed.
removeIf
(Predicate2<? super K, ? super V> predicate)

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

public V

Returns:

The value removed from entry at key, or null if not found.
removeKey
(K key)

Remove an entry from the map at the specified key.

public MutableMapIterable<K, V>
select(Predicate2<? super K, ? super V> predicate)

Redeclares org.eclipse.collections.api.map.MapIterable.select.

For each key and value of the map the predicate is evaluated, if the result of the evaluation is true, that key and value are returned in a new map.

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

Redeclares org.eclipse.collections.api.RichIterable.select.

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

public <S> MutableCollection<S>
selectInstancesOf(Class<S> clazz)

Redeclares org.eclipse.collections.api.RichIterable.selectInstancesOf.

Returns all elements of the source collection that are instances of the Class clazz.

public <P> MutableCollection<V>
selectWith(Predicate2<? super V, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.RichIterable.selectWith.

Similar to select(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

public <V1> MutableObjectDoubleMap<V1>
sumByDouble(Function<? super V, ? extends V1> groupBy, DoubleFunction<? super V> function)

Redeclares org.eclipse.collections.api.RichIterable.sumByDouble.

Groups and sums the values using the two specified functions.

public <V1> MutableObjectDoubleMap<V1>
sumByFloat(Function<? super V, ? extends V1> groupBy, FloatFunction<? super V> function)

Redeclares org.eclipse.collections.api.RichIterable.sumByFloat.

Groups and sums the values using the two specified functions.

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

Redeclares org.eclipse.collections.api.RichIterable.sumByInt.

Groups and sums the values using the two specified functions.

public <V1> MutableObjectLongMap<V1>
sumByLong(Function<? super V, ? extends V1> groupBy, LongFunction<? super V> function)

Redeclares org.eclipse.collections.api.RichIterable.sumByLong.

Groups and sums the values using the two specified functions.

public MutableMapIterable<K, V>
tap(Procedure<? super V> procedure)

Redeclares org.eclipse.collections.api.map.MapIterable.tap.

Executes the Procedure for each value of the map and returns this.

public ImmutableMapIterable<K, V>
toImmutable()

Redeclares org.eclipse.collections.api.map.MapIterable.toImmutable.

Returns an immutable copy of this map.

public 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.

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

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

public MutableMapIterable<K, V>
withAllKeyValueArguments(Pair<? extends K, ? extends V>... keyValuePairs)

Convenience var-args version of withAllKeyValues

public MutableMapIterable<K, V>
withAllKeyValues(Iterable<? extends Pair<? extends K, ? extends V>> keyValues)

This method allows mutable, fixed size, and immutable maps the ability to add elements to their existing elements.

public MutableMapIterable<K, V>
withKeyValue(K key, V value)

This method allows mutable, fixed size, and immutable maps the ability to add elements to their existing elements.

public default MutableMapIterable<K, V>
withMap(Map<? extends K, ? extends V> map)

Similar to putAll(Map), but returns this instead of void

public default MutableMapIterable<K, V>
withMapIterable(MapIterable<? extends K, ? extends V> mapIterable)

public MutableMapIterable<K, V>
withoutAllKeys(Iterable<? extends K> keys)

This method allows mutable, fixed size, and immutable maps the ability to remove elements from their existing elements.

public MutableMapIterable<K, V>
withoutKey(K key)

This method allows mutable, fixed size, and immutable maps the ability to remove elements from their existing elements.

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

Redeclares 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>>
zipWithIndex()

Redeclares org.eclipse.collections.api.RichIterable.zipWithIndex.

Zips this RichIterable with its indices.

Inherited from java.util.Map:
clearcomputecomputeIfAbsentcomputeIfPresentcontainsKeycontainsValuecopyOfentryentrySetequalsgethashCodeisEmptykeySetmergeofofofofofofofofofofofofEntriesputputAllputIfAbsentremoveremovereplacereplacereplaceAllsizevalues
Inherited from org.eclipse.collections.api.map.MapIterable:
containsKeycontainsValuedetectdetectOptionalequalsforEachKeyforEachKeyValueforEachValuegetgetIfAbsentgetIfAbsentValuegetIfAbsentWithhashCodeifPresentApplyinjectIntoKeyValuekeysViewkeyValuesViewparallelStreamspliteratorstreamtoStringvaluesView