Class AbstractMultimap<K,V,C extends java.util.Collection<V>>
- java.lang.Object
-
- org.greenrobot.essentials.collections.AbstractMultimap<K,V,C>
-
- All Implemented Interfaces:
java.util.Map<K,C>
- Direct Known Subclasses:
Multimap,MultimapSet
public abstract class AbstractMultimap<K,V,C extends java.util.Collection<V>> extends java.lang.Object implements java.util.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
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMultimap(java.util.Map<K,C> map)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsElement(K key, V value)booleancontainsElement(V value)booleancontainsKey(java.lang.Object key)booleancontainsValue(java.lang.Object value)intcountElements()intcountElements(K key)protected abstract CcreateNewCollection()java.util.Set<java.util.Map.Entry<K,C>>entrySet()booleanequals(java.lang.Object o)Cget(java.lang.Object key)inthashCode()booleanisEmpty()java.util.Set<K>keySet()Cput(K key, C value)voidputAll(java.util.Map<? extends K,? extends C> m)intputElement(K key, V value)booleanputElements(K key, java.util.Collection<V> values)Cremove(java.lang.Object key)booleanremoveElement(K key, V value)intsize()java.util.Collection<C>values()CvaluesElements()
-
-
-
Method Detail
-
createNewCollection
protected abstract C createNewCollection()
-
containsKey
public boolean containsKey(java.lang.Object key)
-
containsValue
public boolean containsValue(java.lang.Object value)
-
values
public java.util.Collection<C> values()
-
equals
public boolean equals(java.lang.Object o)
-
hashCode
public int hashCode()
-
putElement
public int putElement(K key, V value)
- Returns:
- number of elements stored for given key after storing the given value.
-
putElements
public boolean putElements(K key, java.util.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(V value)
-
valuesElements
public C valuesElements()
-
-