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 protected
AbstractMultimap(java.util.Map<K,C> map)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
containsElement(K key, V value)
boolean
containsElement(V value)
boolean
containsKey(java.lang.Object key)
boolean
containsValue(java.lang.Object value)
int
countElements()
int
countElements(K key)
protected abstract C
createNewCollection()
java.util.Set<java.util.Map.Entry<K,C>>
entrySet()
boolean
equals(java.lang.Object o)
C
get(java.lang.Object key)
int
hashCode()
boolean
isEmpty()
java.util.Set<K>
keySet()
C
put(K key, C value)
void
putAll(java.util.Map<? extends K,? extends C> m)
int
putElement(K key, V value)
boolean
putElements(K key, java.util.Collection<V> values)
C
remove(java.lang.Object key)
boolean
removeElement(K key, V value)
int
size()
java.util.Collection<C>
values()
C
valuesElements()
-
-
-
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()
-
-