Top Description Methods
org.eclipse.collections.api.map

public Interface ImmutableMap<K, V>

extends UnsortedMapIterable<K, V>, ImmutableMapIterable<K, V>
Imports
java.util.Map, org.eclipse.collections.api.bag.ImmutableBag, org.eclipse.collections.api.bag.primitive.ImmutableBooleanBag, .ImmutableByteBag, .ImmutableCharBag, .ImmutableDoubleBag, .ImmutableFloatBag, .ImmutableIntBag, .ImmutableLongBag, .ImmutableShortBag, 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.multimap.bag.ImmutableBagMultimap, org.eclipse.collections.api.multimap.set.ImmutableSetMultimap, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.bag.PartitionImmutableBag, org.eclipse.collections.api.set.ImmutableSet, org.eclipse.collections.api.tuple.Pair

An ImmutableMap is different from a JCF Map because it has no mutating methods. It provides the read-only protocol of a JDK Map.

Method Summary

Modifier and TypeMethod and Description
public default <KK, VV> ImmutableMap<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, org.eclipse.collections.api.map.ImmutableMapIterable.aggregateBy.

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

public default <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.MapIterable.aggregateBy, org.eclipse.collections.api.map.ImmutableMapIterable.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> ImmutableMap<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, org.eclipse.collections.api.map.ImmutableMapIterable.aggregateInPlaceBy.

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

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

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.collect, org.eclipse.collections.api.map.ImmutableMapIterable.collect.

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

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

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.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)

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

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

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

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.collectValues, org.eclipse.collections.api.map.ImmutableMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.collectWith, org.eclipse.collections.api.RichIterable.collectWith.

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

public <R> ImmutableBag<R>
public default <P, R> ImmutableBag<R>
flatCollectWith(Function2<? super V, ? super P, ? extends Iterable<R>> function, P parameter)

Overrides default org.eclipse.collections.api.map.UnsortedMapIterable.flatCollectWith, org.eclipse.collections.api.RichIterable.flatCollectWith.

Same as flatCollect, only with a Function2 that is passed an extra parameter.

public ImmutableSetMultimap<V, K>
flip()

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.flip, org.eclipse.collections.api.map.ImmutableMapIterable.flip.

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

public ImmutableMap<V, K>
flipUniqueValues()

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.flipUniqueValues, org.eclipse.collections.api.map.ImmutableMapIterable.flipUniqueValues.

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

public <VV> ImmutableBagMultimap<VV, V>
groupBy(Function<? super V, ? extends VV> function)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.groupBy, org.eclipse.collections.api.map.ImmutableMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.groupByEach, org.eclipse.collections.api.map.ImmutableMapIterable.groupByEach.

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

public default <V1> ImmutableMap<V1, V>
groupByUniqueKey(Function<? super V, ? extends V1> function)

Implements org.eclipse.collections.api.map.UnsortedMapIterable.groupByUniqueKey, org.eclipse.collections.api.map.ImmutableMapIterable.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 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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.partition, org.eclipse.collections.api.map.ImmutableMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.partitionWith, org.eclipse.collections.api.RichIterable.partitionWith.

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

public default <KK> ImmutableMap<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, org.eclipse.collections.api.map.ImmutableMapIterable.reduceBy.

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

public ImmutableMap<K, V>
reject(Predicate2<? super K, ? super V> predicate)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.reject, org.eclipse.collections.api.map.ImmutableMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.reject, org.eclipse.collections.api.map.ImmutableMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.rejectWith, org.eclipse.collections.api.map.ImmutableMapIterable.rejectWith.

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

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

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.select, org.eclipse.collections.api.map.ImmutableMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.select, org.eclipse.collections.api.map.ImmutableMapIterable.select.

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

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

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.selectInstancesOf, org.eclipse.collections.api.map.ImmutableMapIterable.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)

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.selectWith, org.eclipse.collections.api.map.ImmutableMapIterable.selectWith.

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

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

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.tap, org.eclipse.collections.api.map.ImmutableMapIterable.tap.

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

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

Redeclares org.eclipse.collections.api.map.UnsortedMapIterable.zip, org.eclipse.collections.api.map.ImmutableMapIterable.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.api.map.ImmutableMapIterable:
castToMapcountBycountByEachcountByWith
Inherited from org.eclipse.collections.api.map.UnsortedMapIterable:
toImmutable