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>
-
Method Summary
Modifier and Type Method Description C
get(K key)
Returns a view of all values associated with the given key.boolean
isEmpty()
Returnstrue
if there are no entries.SetIterable<K>
keySet()
Returns a unmodifiableSetIterable
of keys with O(1) complexity.int
size()
Returns the number of key-value entry pairs.int
sizeDistinct()
Returns the number of distinct keys.ImmutableMultimap<K,V>
toImmutable()
Returns an immutable copy of this Multimap if it is not already immutable.MutableMap<K,RichIterable<V>>
toMap()
Returns a newMutableMap
of keys from this Multimap to the mapped values as aRichIterable
.<R extends Collection<V>>
MutableMap<K,R>toMap(Function0<R> collectionFactory)
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, equals, forEachKey, forEachKeyMultiValues, forEachKeyValue, forEachValue, hashCode, keyBag, keyMultiValuePairsView, keysView, keyValuePairsView, multiValuesView, notEmpty, rejectKeysMultiValues, rejectKeysValues, selectKeysMultiValues, selectKeysValues, toString, valuesView
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
-
Method Details
-
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 a 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>
-