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 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.

      Specified by:
      size in interface Multimap<K,​V>
    • sizeDistinct

      public int sizeDistinct()
      Description copied from interface: Multimap
      Returns the number of distinct keys.
      Specified by:
      sizeDistinct in interface Multimap<K,​V>
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Multimap
      Returns true if there are no entries.
      Specified by:
      isEmpty in interface Multimap<K,​V>
    • keySet

      public SetIterable<K> keySet()
      Description copied from interface: Multimap
      Returns a unmodifiable SetIterable of keys with O(1) complexity.
      Specified by:
      keySet in interface Multimap<K,​V>
    • get

      public C get​(K key)
      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.

      Specified by:
      get in interface ImmutableMultimap<K,​V>
      Specified by:
      get in interface Multimap<K,​V>
      Parameters:
      key - the key to search for
    • toMap

      public MutableMap<K,​RichIterable<V>> toMap()
      Description copied from interface: Multimap
      Returns a new MutableMap of keys from this Multimap to the mapped values as a RichIterable.
      Specified by:
      toMap in interface Multimap<K,​V>
    • toMap

      public <R extends Collection<V>> MutableMap<K,​R> toMap​(Function0<R> collectionFactory)
      Description copied from interface: Multimap
      Returns a new MutableMap of keys from this Multimap to the mapped values as a RichIterable.
      Specified by:
      toMap in interface Multimap<K,​V>
      Parameters:
      collectionFactory - used to create the collections that hold the values and affects the return type
    • toImmutable

      public ImmutableMultimap<K,​V> 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 is Serializable.

      Specified by:
      toImmutable in interface Multimap<K,​V>