Top Fields Constructors Methods
org.eclipse.collections.impl.multimap

public abstract Class AbstractImmutableMultimap<K, V, C extends ImmutableCollection<V>>

extends AbstractMultimap<K, V, C extends ImmutableCollection<V>>
implements ImmutableMultimap<K, V>
Class Inheritance
All Implemented Interfaces
org.eclipse.collections.api.multimap.ImmutableMultimap, org.eclipse.collections.api.multimap.Multimap
Known Direct Subclasses
org.eclipse.collections.impl.multimap.bag.ImmutableBagMultimapImpl, org.eclipse.collections.impl.multimap.bag.sorted.immutable.ImmutableSortedBagMultimapImpl, org.eclipse.collections.impl.multimap.list.ImmutableListMultimapImpl, org.eclipse.collections.impl.multimap.set.ImmutableSetMultimapImpl, org.eclipse.collections.impl.multimap.set.sorted.ImmutableSortedSetMultimapImpl
Imports
java.io.InvalidClassException, .ObjectStreamException, java.util.Collection, org.eclipse.collections.api.RichIterable, org.eclipse.collections.api.block.function.Function0, org.eclipse.collections.api.block.procedure.Procedure, org.eclipse.collections.api.collection.ImmutableCollection, org.eclipse.collections.api.factory.Maps, org.eclipse.collections.api.map.ImmutableMap, .MutableMap, org.eclipse.collections.api.multimap.ImmutableMultimap, org.eclipse.collections.api.set.SetIterable, org.eclipse.collections.impl.set.mutable.UnmodifiableMutableSet, org.eclipse.collections.impl.utility.Iterate

Field Summary

Modifier and TypeField and Description
protected final ImmutableMap<K, C>

Constructor Summary

AccessConstructor and Description
protected
AbstractImmutableMultimap(MutableMap<K, C>
place to store the mapping from each key to its corresponding values
map
)

Creates a new multimap that clones the provided map into an ImmutableMap.

protected
AbstractImmutableMultimap(ImmutableMap<K, C>
place to store the mapping from each key to its corresponding values
immutableMap
)

Creates a new multimap that uses the provided immutableMap.

Method Summary

Modifier and TypeMethod and Description
public C
get(K key)

Implements org.eclipse.collections.api.multimap.ImmutableMultimap.get, org.eclipse.collections.api.multimap.Multimap.get.

Returns a view of all values associated with the given key.

protected ImmutableMap<K, C>
public boolean
isEmpty()

Implements org.eclipse.collections.api.multimap.Multimap.isEmpty.

Returns true if there are no entries.

public SetIterable<K>
keySet()

Implements org.eclipse.collections.api.multimap.Multimap.keySet.

Returns an unmodifiable SetIterable of keys with O(1) complexity.

protected Object
public int
size()

Implements org.eclipse.collections.api.multimap.Multimap.size.

Returns the number of key-value entry pairs.

public int
sizeDistinct()

Implements org.eclipse.collections.api.multimap.Multimap.sizeDistinct.

Returns the number of distinct keys.

public ImmutableMultimap<K, V>
toImmutable()

Implements org.eclipse.collections.api.multimap.Multimap.toImmutable.

Returns an immutable copy of this Multimap if it is not already immutable.

public MutableMap<K, RichIterable<V>>
toMap()

Implements org.eclipse.collections.api.multimap.Multimap.toMap.

Returns a new MutableMap of keys from this Multimap to the mapped values as a RichIterable.

public <R extends Collection<V>> MutableMap<K, R>
toMap(Function0<R> collectionFactory)

Implements org.eclipse.collections.api.multimap.Multimap.toMap.

Returns a new MutableMap of keys from this Multimap to the mapped values as a RichIterable.

Inherited from org.eclipse.collections.impl.multimap.AbstractMultimap:
collectKeyMultiValuescollectKeysValuescollectValuescontainsKeycontainsKeyAndValuecontainsValuecreateCollectioncreateCollectionBlockequalsforEachKeyforEachKeyMultiValuesforEachKeyValueforEachValuehashCodekeyBagkeyMultiValuePairsViewkeysViewkeyValuePairsViewmultiValuesViewnotEmptyrejectKeysMultiValuesrejectKeysValuesselectKeysMultiValuesselectKeysValuestoStringvaluesView

Field Detail

mapback to summary
protected final ImmutableMap<K, C> map

Constructor Detail

AbstractImmutableMultimapback to summary
protected AbstractImmutableMultimap(MutableMap<K, C> map)

Creates a new multimap that clones the provided map into an ImmutableMap.

Parameters
map:MutableMap<K, C>

place to store the mapping from each key to its corresponding values

AbstractImmutableMultimapback to summary
protected AbstractImmutableMultimap(ImmutableMap<K, C> immutableMap)

Creates a new multimap that uses the provided immutableMap.

Parameters
immutableMap:ImmutableMap<K, C>

place to store the mapping from each key to its corresponding values

Method Detail

getback to summary
public C get(K key)

Implements org.eclipse.collections.api.multimap.ImmutableMultimap.get, org.eclipse.collections.api.multimap.Multimap.get.

Doc from org.eclipse.collections.api.multimap.Multimap.get.

Returns a view of all values associated with the given key.

If the given key does not exist, an empty RichIterable is returned.

Annotations
@Override
getMapback to summary
protected ImmutableMap<K, C> getMap()

Implements abstract org.eclipse.collections.impl.multimap.AbstractMultimap.getMap.

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Implements org.eclipse.collections.api.multimap.Multimap.isEmpty.

Doc from org.eclipse.collections.api.multimap.Multimap.isEmpty.

Returns true if there are no entries.

Annotations
@Override
keySetback to summary
public SetIterable<K> keySet()

Implements org.eclipse.collections.api.multimap.Multimap.keySet.

Doc from org.eclipse.collections.api.multimap.Multimap.keySet.

Returns an unmodifiable SetIterable of keys with O(1) complexity.

Annotations
@Override
readResolveback to summary
protected Object readResolve() throws ObjectStreamException
sizeback to summary
public int size()

Implements org.eclipse.collections.api.multimap.Multimap.size.

Doc from org.eclipse.collections.api.multimap.Multimap.size.

Returns the number of key-value entry pairs.

This method is implemented with O(1) (constant-time) performance.

Annotations
@Override
sizeDistinctback to summary
public int sizeDistinct()

Implements org.eclipse.collections.api.multimap.Multimap.sizeDistinct.

Doc from org.eclipse.collections.api.multimap.Multimap.sizeDistinct.

Returns the number of distinct keys.

Annotations
@Override
toImmutableback to summary
public ImmutableMultimap<K, V> toImmutable()

Implements org.eclipse.collections.api.multimap.Multimap.toImmutable.

Doc from org.eclipse.collections.api.multimap.Multimap.toImmutable.

Returns an immutable copy of this Multimap if it is not already immutable. If the Multimap is immutable, it will return itself.

The returned Multimap will be Serializable if this Multimap is Serializable.

Annotations
@Override
toMapback to summary
public MutableMap<K, RichIterable<V>> toMap()

Implements org.eclipse.collections.api.multimap.Multimap.toMap.

Doc from org.eclipse.collections.api.multimap.Multimap.toMap.

Returns a new MutableMap of keys from this Multimap to the mapped values as a RichIterable.

Annotations
@Override
toMapback to summary
public <R extends Collection<V>> MutableMap<K, R> toMap(Function0<R> collectionFactory)

Implements org.eclipse.collections.api.multimap.Multimap.toMap.

Doc from org.eclipse.collections.api.multimap.Multimap.toMap.

Returns a new MutableMap of keys from this Multimap to the mapped values as a RichIterable.

Annotations
@Override