Class AbstractMultimap<K,V,C extends Collection<V>>

java.lang.Object
org.greenrobot.essentials.collections.AbstractMultimap<K,V,C>
All Implemented Interfaces:
Map<K,C>
Direct Known Subclasses:
Multimap, MultimapSet

public abstract class AbstractMultimap<K,V,C extends Collection<V>> extends Object implements Map<K,C>
Combines a Map with List values to provide simple way to store multiple values for a key (multimap).

Threading note: All methods are synchronized

  • Field Details

  • Constructor Details

    • AbstractMultimap

      protected AbstractMultimap(Map<K,C> map)
  • Method Details

    • createNewCollection

      protected abstract C createNewCollection()
    • putAll

      public void putAll(Map<? extends K,? extends C> m)
      Specified by:
      putAll in interface Map<K,V>
    • size

      public int size()
      Specified by:
      size in interface Map<K,V>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map<K,V>
    • containsKey

      public boolean containsKey(Object key)
      Specified by:
      containsKey in interface Map<K,V>
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface Map<K,V>
    • get

      public C get(Object key)
      Specified by:
      get in interface Map<K,V>
    • remove

      public C remove(Object key)
      Specified by:
      remove in interface Map<K,V>
    • clear

      public void clear()
      Specified by:
      clear in interface Map<K,V>
    • keySet

      public Set<K> keySet()
      Specified by:
      keySet in interface Map<K,V>
    • values

      public Collection<C> values()
      Specified by:
      values in interface Map<K,V>
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Map<K,V>
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map<K,V>
      Overrides:
      hashCode in class Object
    • putElement

      public int putElement(K key, V value)
      Returns:
      number of elements stored for given key after storing the given value.
    • put

      public C put(K key, C value)
      Specified by:
      put in interface Map<K,V>
    • entrySet

      public Set<Map.Entry<K,C>> entrySet()
      Specified by:
      entrySet in interface Map<K,V>
    • putElements

      public boolean putElements(K key, Collection<V> values)
      Returns:
      true if the collection was changed.
    • removeElement

      public boolean removeElement(K key, V value)
      Returns:
      true if the given element was removed.
    • countElements

      public int countElements(K key)
    • countElements

      public int countElements()
    • containsElement

      public boolean containsElement(K key, V value)
    • containsElement

      public boolean containsElement(V value)
    • valuesElements

      public C valuesElements()