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
ConstructorsModifierConstructorDescriptionprotectedAbstractImmutableMultimap(ImmutableMap<K, C> immutableMap) Creates a new multimap that uses the provided immutableMap.protectedCreates 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()booleanisEmpty()Returnstrueif there are no entries.keySet()Returns an unmodifiableSetIterableof keys with O(1) complexity.protected Objectintsize()Returns the number of key-value entry pairs.intReturns the number of distinct keys.Returns an immutable copy of this Multimap if it is not already immutable.MutableMap<K, RichIterable<V>> toMap()Returns a newMutableMapof keys from this Multimap to the mapped values as aRichIterable.<R extends Collection<V>>
MutableMap<K, R> Returns a newMutableMapof keys from this Multimap to the mapped values as aRichIterable.Methods inherited from class 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, valuesViewMethods inherited from interface ImmutableMultimap
collectKeyMultiValues, collectKeysValues, collectValues, flip, newEmpty, newWith, newWithAll, newWithout, newWithoutAll, rejectKeysMultiValues, rejectKeysValues, selectKeysMultiValues, selectKeysValuesMethods inherited from interface 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:
getMapin classAbstractMultimap<K, V, C extends ImmutableCollection<V>>
-
size
-
sizeDistinct
public int sizeDistinct()Description copied from interface:MultimapReturns the number of distinct keys.- Specified by:
sizeDistinctin interfaceMultimap<K,V>
-
isEmpty
-
keySet
Description copied from interface:MultimapReturns an unmodifiableSetIterableof keys with O(1) complexity. -
get
Description copied from interface:MultimapReturns a view of all values associated with the given key.If the given key does not exist, an empty
RichIterableis returned. -
toMap
Description copied from interface:MultimapReturns a newMutableMapof keys from this Multimap to the mapped values as aRichIterable. -
toMap
Description copied from interface:MultimapReturns a newMutableMapof keys from this Multimap to the mapped values as aRichIterable. -
toImmutable
Description copied from interface:MultimapReturns 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
Serializableif this Multimap isSerializable.- Specified by:
toImmutablein interfaceMultimap<K,V>
-
readResolve
- Throws:
ObjectStreamException
-