Top Constructors Methods
org.eclipse.collections.impl.map.immutable

public abstract Class AbstractImmutableMap<K, V>

extends AbstractMapIterable<K, V>
implements ImmutableMap<K, V>, Map<K, V>
Class Inheritance
All Implemented Interfaces
java.util.Map, org.eclipse.collections.api.map.ImmutableMap, org.eclipse.collections.api.map.ImmutableMapIterable, org.eclipse.collections.api.map.MapIterable, org.eclipse.collections.api.RichIterable, org.eclipse.collections.api.InternalIterable, java.lang.Iterable, org.eclipse.collections.api.map.UnsortedMapIterable
Known Direct Subclasses
org.eclipse.collections.impl.map.immutable.ImmutableDoubletonMap, org.eclipse.collections.impl.map.immutable.ImmutableEmptyMap, org.eclipse.collections.impl.map.immutable.ImmutableQuadrupletonMap, org.eclipse.collections.impl.map.immutable.ImmutableSingletonMap, org.eclipse.collections.impl.map.immutable.ImmutableTripletonMap, org.eclipse.collections.impl.map.immutable.ImmutableUnifiedMap, org.eclipse.collections.impl.map.strategy.immutable.ImmutableEmptyMapWithHashingStrategy, org.eclipse.collections.impl.map.strategy.immutable.ImmutableUnifiedMapWithHashingStrategy
Imports
java.util.Iterator, .Map, .Optional, .Set, java.util.function.BiConsumer, org.eclipse.collections.api.bag.ImmutableBag, .MutableBag, org.eclipse.collections.api.bag.primitive.ImmutableBooleanBag, .ImmutableByteBag, .ImmutableCharBag, .ImmutableDoubleBag, .ImmutableFloatBag, .ImmutableIntBag, .ImmutableLongBag, .ImmutableShortBag, .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, org.eclipse.collections.api.factory.Bags, .Maps, .Sets, org.eclipse.collections.api.factory.primitive.BooleanBags, .ByteBags, .CharBags, .DoubleBags, .FloatBags, .IntBags, .LongBags, .ObjectDoubleMaps, .ObjectLongMaps, .ShortBags, org.eclipse.collections.api.map.ImmutableMap, .MapIterable, .MutableMap, org.eclipse.collections.api.map.primitive.ImmutableObjectDoubleMap, .ImmutableObjectLongMap, .MutableObjectDoubleMap, .MutableObjectLongMap, org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap, org.eclipse.collections.api.multimap.set.ImmutableSetMultimap, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.bag.PartitionImmutableBag, .PartitionMutableBag, org.eclipse.collections.api.set.ImmutableSet, .MutableSet, org.eclipse.collections.api.tuple.Pair, org.eclipse.collections.impl.block.factory.Functions, .Predicates, .PrimitiveFunctions, org.eclipse.collections.impl.block.procedure.PartitionPredicate2Procedure, .PartitionProcedure, .SelectInstancesOfProcedure, org.eclipse.collections.impl.map.AbstractMapIterable, org.eclipse.collections.impl.map.mutable.UnifiedMap, org.eclipse.collections.impl.multimap.bag.HashBagMultimap, org.eclipse.collections.impl.partition.bag.PartitionHashBag, org.eclipse.collections.impl.tuple.ImmutableEntry, org.eclipse.collections.impl.utility.MapIterate

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public <K1, V1, V2> ImmutableMap<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.ImmutableMap.aggregateBy, 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 Map<K, V>
public void
clear()

Implements java.util.Map.clear.

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

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

Implements org.eclipse.collections.api.map.ImmutableMap.collect, org.eclipse.collections.api.map.MapIterable.collect.

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

public <R> ImmutableBag<R>
collect(Function<? super V, ? extends R> function)

Implements org.eclipse.collections.api.map.ImmutableMap.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 ImmutableBooleanBag
collectBoolean(BooleanFunction<? super V> booleanFunction)

Implements org.eclipse.collections.api.map.ImmutableMap.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 ImmutableByteBag
collectByte(ByteFunction<? super V> byteFunction)

Implements org.eclipse.collections.api.map.ImmutableMap.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 ImmutableCharBag
collectChar(CharFunction<? super V> charFunction)

Implements org.eclipse.collections.api.map.ImmutableMap.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 ImmutableDoubleBag
collectDouble(DoubleFunction<? super V> doubleFunction)

Implements org.eclipse.collections.api.map.ImmutableMap.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 ImmutableFloatBag
collectFloat(FloatFunction<? super V> floatFunction)

Implements org.eclipse.collections.api.map.ImmutableMap.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 <R> ImmutableBag<R>
collectIf(Predicate<? super V> predicate, Function<? super V, ? extends R> function)

Implements org.eclipse.collections.api.map.ImmutableMap.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 ImmutableIntBag
collectInt(IntFunction<? super V> intFunction)

Implements org.eclipse.collections.api.map.ImmutableMap.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 <R> ImmutableMap<R, V>
collectKeysUnique(Function2<? super K, ? super V, ? extends R> function)

Implements org.eclipse.collections.api.map.ImmutableMap.collectKeysUnique, org.eclipse.collections.api.map.MapIterable.collectKeysUnique.

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

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

Implements org.eclipse.collections.api.map.ImmutableMap.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 ImmutableShortBag
collectShort(ShortFunction<? super V> shortFunction)

Implements org.eclipse.collections.api.map.ImmutableMap.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> ImmutableMap<K, R>
collectValues(Function2<? super K, ? super V, ? extends R> function)

Implements org.eclipse.collections.api.map.ImmutableMap.collectValues, org.eclipse.collections.api.map.MapIterable.collectValues.

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

public <P, VV> ImmutableBag<VV>
collectWith(Function2<? super V, ? super P, ? extends VV> function, P parameter)

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

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

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

Overrides default org.eclipse.collections.api.RichIterable.countBy, org.eclipse.collections.api.map.ImmutableMapIterable.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> ImmutableBag<V1>
countByEach(Function<? super V, ? extends Iterable<V1>> function)

Overrides org.eclipse.collections.impl.AbstractRichIterable.countByEach.

Overrides default org.eclipse.collections.api.RichIterable.countByEach, org.eclipse.collections.api.map.ImmutableMapIterable.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> ImmutableBag<V1>
countByWith(Function2<? super V, ? super P, ? extends V1> function, P parameter)

Overrides default org.eclipse.collections.api.RichIterable.countByWith, org.eclipse.collections.api.map.ImmutableMapIterable.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 Set<Map.Entry<K, V>>
entrySet()

Implements java.util.Map.entrySet.

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

public <R> ImmutableBag<R>
public ImmutableSetMultimap<V, K>
flip()

Implements org.eclipse.collections.api.map.ImmutableMap.flip, org.eclipse.collections.api.map.MapIterable.flip.

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

public ImmutableMap<V, K>
flipUniqueValues()

Implements org.eclipse.collections.api.map.ImmutableMap.flipUniqueValues, 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 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 <VV> ImmutableBagMultimap<VV, V>
groupBy(Function<? super V, ? extends VV> function)

Implements org.eclipse.collections.api.map.ImmutableMap.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 <VV> ImmutableBagMultimap<VV, V>
groupByEach(Function<? super V, ? extends Iterable<VV>> function)

Implements org.eclipse.collections.api.map.ImmutableMap.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 <V1> ImmutableMap<V1, V>
groupByUniqueKey(Function<? super V, ? extends V1> function)

Overrides default org.eclipse.collections.api.map.ImmutableMap.groupByUniqueKey.

Implements 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 Iterator<V>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public ImmutableMap<K, V>
public ImmutableMap<K, V>
public ImmutableMap<K, V>
public ImmutableMap<K, V>
public ImmutableMap<K, V>
public ImmutableMap<K, V>
public ImmutableMap<K, V>
public PartitionImmutableBag<V>
partition(Predicate<? super V> predicate)

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

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

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

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

Filters a collection into a PartitionIterable 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 ImmutableMap<K, V>
reject(Predicate2<? super K, ? super V> predicate)

Implements org.eclipse.collections.api.map.ImmutableMap.reject, 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 ImmutableBag<V>
reject(Predicate<? super V> predicate)

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

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

public <P> ImmutableBag<V>
rejectWith(Predicate2<? super V, ? super P> predicate, P parameter)

Implements org.eclipse.collections.api.map.ImmutableMap.rejectWith, org.eclipse.collections.api.RichIterable.rejectWith.

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

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 ImmutableMap<K, V>
select(Predicate2<? super K, ? super V> predicate)

Implements org.eclipse.collections.api.map.ImmutableMap.select, 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 ImmutableBag<V>
select(Predicate<? super V> predicate)

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

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

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

Implements org.eclipse.collections.api.map.ImmutableMap.selectInstancesOf, org.eclipse.collections.api.RichIterable.selectInstancesOf.

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

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

Implements org.eclipse.collections.api.map.ImmutableMap.selectWith, org.eclipse.collections.api.RichIterable.selectWith.

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

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

Implements org.eclipse.collections.api.RichIterable.sumByDouble.

Groups and sums the values using the two specified functions.

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

Implements org.eclipse.collections.api.RichIterable.sumByFloat.

Groups and sums the values using the two specified functions.

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

Implements org.eclipse.collections.api.RichIterable.sumByInt.

Groups and sums the values using the two specified functions.

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

Implements org.eclipse.collections.api.RichIterable.sumByLong.

Groups and sums the values using the two specified functions.

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

Implements org.eclipse.collections.api.map.ImmutableMap.tap, org.eclipse.collections.api.map.MapIterable.tap, org.eclipse.collections.api.RichIterable.tap.

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

public ImmutableMap<K, V>
public MutableMap<K, V>
public <S> ImmutableBag<Pair<V, S>>
zip(Iterable<S> that)

Implements org.eclipse.collections.api.map.ImmutableMap.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 ImmutableSet<Pair<V, Integer>>
Inherited from org.eclipse.collections.impl.map.AbstractMapIterable:
allSatisfyallSatisfyWithanySatisfyanySatisfyWithasLazychunkcontainsdetectdetectIfNonedetectOptionaldetectWithdetectWithIfNonedetectWithOptionaleachforEachKeyforEachValueforEachWithforEachWithIndexgetFirstgetIfAbsentgetIfAbsentValuegetIfAbsentWithgetLastgetOnlygetOrDefaultifPresentApplyisAbsentkeyAndValueEqualskeyAndValueHashCodenoneSatisfynoneSatisfyWithtoArraytoArray