Class AbstractImmutableMultimap<K,V,C extends ImmutableCollection<V>>
java.lang.Object
org.eclipse.collections.impl.multimap.AbstractMultimap<K,V,C>
org.eclipse.collections.impl.multimap.AbstractImmutableMultimap<K,V,C>
- All Implemented Interfaces:
ImmutableMultimap<K,
,V> Multimap<K,
V>
- Direct Known Subclasses:
ImmutableBagMultimapImpl
,ImmutableListMultimapImpl
,ImmutableSetMultimapImpl
,ImmutableSortedBagMultimapImpl
,ImmutableSortedSetMultimapImpl
public abstract class AbstractImmutableMultimap<K,V,C extends ImmutableCollection<V>>
extends AbstractMultimap<K,V,C>
implements ImmutableMultimap<K,V>
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractImmutableMultimap
(ImmutableMap<K, C> immutableMap) Creates a new multimap that uses the provided immutableMap.protected
Creates a new multimap that clones the provided map into an ImmutableMap. -
Method Summary
Modifier and TypeMethodDescriptionReturns a view of all values associated with the given key.protected ImmutableMap
<K, C> getMap()
boolean
isEmpty()
Returnstrue
if there are no entries.keySet()
Returns an unmodifiableSetIterable
of keys with O(1) complexity.protected Object
int
size()
Returns the number of key-value entry pairs.int
Returns the number of distinct keys.Returns an immutable copy of this Multimap if it is not already immutable.toMap()
Returns a newMutableMap
of keys from this Multimap to the mapped values as aRichIterable
.<R extends Collection<V>>
MutableMap<K, R> Returns a newMutableMap
of keys from this Multimap to the mapped values as aRichIterable
.Methods inherited from class org.eclipse.collections.impl.multimap.AbstractMultimap
collectKeyMultiValues, collectKeysValues, collectValues, containsKey, containsKeyAndValue, containsValue, createCollection, createCollectionBlock, equals, forEachKey, forEachKeyMultiValues, forEachKeyValue, forEachValue, hashCode, keyBag, keyMultiValuePairsView, keysView, keyValuePairsView, multiValuesView, notEmpty, rejectKeysMultiValues, rejectKeysValues, selectKeysMultiValues, selectKeysValues, toString, valuesView
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.collections.api.multimap.ImmutableMultimap
collectKeyMultiValues, collectKeysValues, collectValues, flip, newEmpty, newWith, newWithAll, newWithout, newWithoutAll, rejectKeysMultiValues, rejectKeysValues, selectKeysMultiValues, selectKeysValues
Methods inherited from interface org.eclipse.collections.api.multimap.Multimap
collectKeyMultiValues, collectKeysValues, collectValues, containsKey, containsKeyAndValue, containsValue, equals, forEachKey, forEachKeyMultiValues, forEachKeyValue, forEachValue, hashCode, keyBag, keyMultiValuePairsView, keysView, keyValuePairsView, multiValuesView, notEmpty, rejectKeysMultiValues, rejectKeysValues, selectKeysMultiValues, selectKeysValues, toMutable, valuesView
-
Field Details
-
map
-
-
Constructor Details
-
AbstractImmutableMultimap
Creates a new multimap that clones the provided map into an ImmutableMap.- Parameters:
map
- place to store the mapping from each key to its corresponding values
-
AbstractImmutableMultimap
Creates a new multimap that uses the provided immutableMap.- Parameters:
immutableMap
- place to store the mapping from each key to its corresponding values
-
-
Method Details
-
getMap
- Specified by:
getMap
in classAbstractMultimap<K,
V, C extends ImmutableCollection<V>>
-
size
public int size()Description copied from interface:Multimap
Returns the number of key-value entry pairs.This method is implemented with O(1) (constant-time) performance.
-
sizeDistinct
public int sizeDistinct()Description copied from interface:Multimap
Returns the number of distinct keys.- Specified by:
sizeDistinct
in interfaceMultimap<K,
V>
-
isEmpty
public boolean isEmpty()Description copied from interface:Multimap
Returnstrue
if there are no entries. -
keySet
Description copied from interface:Multimap
Returns an unmodifiableSetIterable
of keys with O(1) complexity. -
get
Description copied from interface:Multimap
Returns a view of all values associated with the given key.If the given key does not exist, an empty
RichIterable
is returned. -
toMap
Description copied from interface:Multimap
Returns a newMutableMap
of keys from this Multimap to the mapped values as aRichIterable
. -
toMap
Description copied from interface:Multimap
Returns a newMutableMap
of keys from this Multimap to the mapped values as aRichIterable
. -
toImmutable
Description copied from interface:Multimap
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 isSerializable
.- Specified by:
toImmutable
in interfaceMultimap<K,
V>
-
readResolve
- Throws:
ObjectStreamException
-