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

public Class SynchronizedMutableMap<K, V>

extends AbstractSynchronizedMapIterable<K, V>
implements MutableMap<K, V>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.eclipse.collections.api.map.MutableMap, java.lang.Cloneable, org.eclipse.collections.api.map.UnsortedMapIterable, org.eclipse.collections.api.map.MapIterable, org.eclipse.collections.api.RichIterable, org.eclipse.collections.api.InternalIterable, java.lang.Iterable, org.eclipse.collections.api.map.MutableMapIterable, java.util.Map
Imports
java.io.Serializable, java.util.Collection, .Collections, .Map, .Set, org.eclipse.collections.api.bag.MutableBag, org.eclipse.collections.api.bag.primitive.MutableBooleanBag, .MutableByteBag, .MutableCharBag, .MutableDoubleBag, .MutableFloatBag, .MutableIntBag, .MutableLongBag, .MutableShortBag, org.eclipse.collections.api.block.function.Function, .Function0, .Function2, org.eclipse.collections.api.block.function.primitive.BooleanFunction, .ByteFunction, .CharFunction, .DoubleFunction, .FloatFunction, .IntFunction, .LongFunction, .ShortFunction, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.procedure.Procedure, .Procedure2, org.eclipse.collections.api.factory.Maps, org.eclipse.collections.api.map.ImmutableMap, .MapIterable, .MutableMap, org.eclipse.collections.api.multimap.bag.MutableBagMultimap, org.eclipse.collections.api.multimap.set.MutableSetMultimap, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.bag.PartitionMutableBag, org.eclipse.collections.api.set.MutableSet, org.eclipse.collections.api.tuple.Pair, org.eclipse.collections.impl.collection.mutable.SynchronizedMutableCollection, org.eclipse.collections.impl.list.fixed.ArrayAdapter, org.eclipse.collections.impl.map.AbstractSynchronizedMapIterable, org.eclipse.collections.impl.set.mutable.SynchronizedMutableSet

A synchronized view of a MutableMap. It is imperative that the user manually synchronize on the collection when iterating over it using the standard JDK iterator or JDK 5 for loop, as per Collections#synchronizedCollection(Collection).
See Also
MutableMap#asSynchronized()

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
public
public
SynchronizedMutableMap(MutableMap<K, V> newMap, Object newLock)

Method Summary

Modifier and TypeMethod and Description
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)

Overrides org.eclipse.collections.impl.map.AbstractSynchronizedMapIterable.aggregateBy.

Overrides default org.eclipse.collections.api.map.MutableMap.aggregateBy, 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> MutableMap<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 org.eclipse.collections.impl.map.AbstractSynchronizedMapIterable.aggregateBy.

Overrides default org.eclipse.collections.api.map.MutableMap.aggregateBy, 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> MutableMap<KK, VV>
aggregateInPlaceBy(Function<? super V, ? extends KK> groupBy, Function0<? extends VV> zeroValueFactory, Procedure2<? super VV, ? super V> mutatingAggregator)

Overrides org.eclipse.collections.impl.map.AbstractSynchronizedMapIterable.aggregateInPlaceBy.

Overrides default org.eclipse.collections.api.map.MutableMap.aggregateInPlaceBy, 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 MutableMap<K, V>
public MutableMap<K, V>
public MutableMap<K, V>
clone()

Overrides java.lang.Object.clone.

Implements org.eclipse.collections.api.map.MutableMap.clone.

Creates and returns a copy of this object.

public <K2, V2> MutableMap<K2, V2>
collect(Function2<? super K, ? super V, Pair<K2, V2>> pairFunction)

Implements org.eclipse.collections.api.map.MutableMap.collect, org.eclipse.collections.api.map.MutableMapIterable.collect.

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

public <A> MutableBag<A>
collect(Function<? super V, ? extends A> function)

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

Implements org.eclipse.collections.api.map.MutableMap.collect, org.eclipse.collections.api.RichIterable.collect.

Returns a new collection with the results of applying the specified function on each element of the source collection.

public MutableBooleanBag
collectBoolean(BooleanFunction<? super V> booleanFunction)

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

Implements org.eclipse.collections.api.map.MutableMap.collectBoolean, org.eclipse.collections.api.RichIterable.collectBoolean.

Returns a new primitive boolean iterable with the results of applying the specified function on each element of the source collection.

public MutableByteBag
collectByte(ByteFunction<? super V> byteFunction)

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

Implements org.eclipse.collections.api.map.MutableMap.collectByte, org.eclipse.collections.api.RichIterable.collectByte.

Returns a new primitive byte iterable with the results of applying the specified function on each element of the source collection.

public MutableCharBag
collectChar(CharFunction<? super V> charFunction)

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

Implements org.eclipse.collections.api.map.MutableMap.collectChar, org.eclipse.collections.api.RichIterable.collectChar.

Returns a new primitive char iterable with the results of applying the specified function on each element of the source collection.

public MutableDoubleBag
collectDouble(DoubleFunction<? super V> doubleFunction)

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

Implements org.eclipse.collections.api.map.MutableMap.collectDouble, org.eclipse.collections.api.RichIterable.collectDouble.

Returns a new primitive double iterable with the results of applying the specified function on each element of the source collection.

public MutableFloatBag
collectFloat(FloatFunction<? super V> floatFunction)

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

Implements org.eclipse.collections.api.map.MutableMap.collectFloat, org.eclipse.collections.api.RichIterable.collectFloat.

Returns a new primitive float iterable with the results of applying the specified function on each element of the source collection.

public <A> MutableBag<A>
collectIf(Predicate<? super V> predicate, Function<? super V, ? extends A> function)

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

Implements org.eclipse.collections.api.map.MutableMap.collectIf, org.eclipse.collections.api.RichIterable.collectIf.

Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate.

public MutableIntBag
collectInt(IntFunction<? super V> intFunction)

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

Implements org.eclipse.collections.api.map.MutableMap.collectInt, org.eclipse.collections.api.RichIterable.collectInt.

Returns a new primitive int iterable with the results of applying the specified function on each element of the source collection.

public <E> MutableMap<K, V>
collectKeysAndValues(Iterable<E> iterable, Function<? super E, ? extends K> keyFunction, Function<? super E, ? extends V> function)

Implements org.eclipse.collections.api.map.MutableMap.collectKeysAndValues.

Adds all the entries derived from iterable to this.

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

Implements org.eclipse.collections.api.map.MutableMap.collectKeysUnique, org.eclipse.collections.api.map.MutableMapIterable.collectKeysUnique.

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

public MutableLongBag
collectLong(LongFunction<? super V> longFunction)

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

Implements org.eclipse.collections.api.map.MutableMap.collectLong, org.eclipse.collections.api.RichIterable.collectLong.

Returns a new primitive long iterable with the results of applying the specified function on each element of the source collection.

public MutableShortBag
collectShort(ShortFunction<? super V> shortFunction)

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

Implements org.eclipse.collections.api.map.MutableMap.collectShort, org.eclipse.collections.api.RichIterable.collectShort.

Returns a new primitive short iterable with the results of applying the specified function on each element of the source collection.

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

Implements org.eclipse.collections.api.map.MutableMap.collectValues, org.eclipse.collections.api.map.MutableMapIterable.collectValues.

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

public <P, A> MutableBag<A>
collectWith(Function2<? super V, ? super P, ? extends A> function, P parameter)

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

Implements org.eclipse.collections.api.map.MutableMap.collectWith, org.eclipse.collections.api.RichIterable.collectWith.

Same as collect(Function) with a Function2 and specified parameter which is passed to the block.

public Set<Map.Entry<K, V>>
entrySet()

Implements java.util.Map.entrySet.

Returns a Set view of the mappings contained in this map.

public <A> MutableBag<A>
public MutableSetMultimap<V, K>
flip()

Implements org.eclipse.collections.api.map.MutableMap.flip, org.eclipse.collections.api.map.MutableMapIterable.flip.

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

public MutableMap<V, K>
flipUniqueValues()

Implements org.eclipse.collections.api.map.MutableMap.flipUniqueValues, org.eclipse.collections.api.map.MutableMapIterable.flipUniqueValues.

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

protected MutableMap<K, V>
public <KK> MutableBagMultimap<KK, V>
groupBy(Function<? super V, ? extends KK> function)

Overrides org.eclipse.collections.impl.map.AbstractSynchronizedMapIterable.groupBy.

Implements org.eclipse.collections.api.map.MutableMap.groupBy, 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 <KK> MutableBagMultimap<KK, V>
public <VV> MutableMap<VV, V>
groupByUniqueKey(Function<? super V, ? extends VV> function)

Overrides org.eclipse.collections.impl.map.AbstractSynchronizedMapIterable.groupByUniqueKey.

Overrides default org.eclipse.collections.api.map.MutableMap.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 Set<K>
keySet()

Implements java.util.Map.keySet.

Returns a Set view of the keys contained in this map.

public MutableMap<K, V>
newEmpty()

Implements org.eclipse.collections.api.map.MutableMap.newEmpty, org.eclipse.collections.api.map.MutableMapIterable.newEmpty.

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

public static <K, V, M extends Map<K, V>> SynchronizedMutableMap<K, V>
of(M map)

This method will take a MutableMap and wrap it directly in a SynchronizedMutableMap.

public static <K, V, M extends Map<K, V>> SynchronizedMutableMap<K, V>
of(M map, Object lock)

Hides java.util.Map.of.

This method will take a MutableMap and wrap it directly in a SynchronizedMutableMap.

public PartitionMutableBag<V>
public <P> PartitionMutableBag<V>
partitionWith(Predicate2<? super V, ? super P> predicate, P parameter)

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

Implements org.eclipse.collections.api.map.MutableMap.partitionWith, org.eclipse.collections.api.RichIterable.partitionWith.

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

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

Overrides org.eclipse.collections.impl.map.AbstractSynchronizedMapIterable.reduceBy.

Overrides default org.eclipse.collections.api.map.MutableMap.reduceBy, 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 MutableMap<K, V>
reject(Predicate2<? super K, ? super V> predicate)

Implements org.eclipse.collections.api.map.MutableMap.reject, org.eclipse.collections.api.map.MutableMapIterable.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 MutableBag<V>
public <P> MutableBag<V>
public MutableMap<K, V>
select(Predicate2<? super K, ? super V> predicate)

Implements org.eclipse.collections.api.map.MutableMap.select, org.eclipse.collections.api.map.MutableMapIterable.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 MutableBag<V>
public <S> MutableBag<S>
public <P> MutableBag<V>
public MutableMap<K, V>
public ImmutableMap<K, V>
public Collection<V>
values()

Implements java.util.Map.values.

Returns a Collection view of the values contained in this map.

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

Implements org.eclipse.collections.api.map.MutableMap.withAllKeyValues, org.eclipse.collections.api.map.MutableMapIterable.withAllKeyValues.

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

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

Implements org.eclipse.collections.api.map.MutableMap.withKeyValue, org.eclipse.collections.api.map.MutableMapIterable.withKeyValue.

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

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

Overrides default org.eclipse.collections.api.map.MutableMap.withMap, org.eclipse.collections.api.map.MutableMapIterable.withMap.

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

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

Implements org.eclipse.collections.api.map.MutableMap.withoutAllKeys, org.eclipse.collections.api.map.MutableMapIterable.withoutAllKeys.

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

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

Implements org.eclipse.collections.api.map.MutableMap.withoutKey, org.eclipse.collections.api.map.MutableMapIterable.withoutKey.

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

protected Object
public <S> MutableBag<Pair<V, S>>
zip(Iterable<S> that)

Overrides org.eclipse.collections.impl.map.AbstractSynchronizedMapIterable.zip.

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

Deprecated in 6.0. Use OrderedIterable#zip(Iterable) instead.

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

public MutableSet<Pair<V, Integer>>
Inherited from org.eclipse.collections.impl.map.AbstractSynchronizedMapIterable:
addclearcontainsKeycontainsValuecountBycountByEachcountByWithdetectdetectOptionalforEachKeyforEachKeyValueforEachValuegetgetIfAbsentgetIfAbsentPutgetIfAbsentPutgetIfAbsentPutWithgetIfAbsentPutWithKeygetIfAbsentValuegetIfAbsentWithifPresentApplykeysViewkeyValuesViewmergeputputAllputPairremoveremoveAllKeysremoveIfremoveKeysumByDoublesumByFloatsumByIntsumByLongupdateValueupdateValueWithvaluesView