K
- the type of the keys in this mapV
- the type of the values in this mappublic abstract class AbstractSetValuedMap<K,V> extends AbstractMultiValuedMap<K,V> implements SetValuedMap<K,V>
SetValuedMap
interface to simplify the
creation of subclass implementations.
Subclasses specify a Map implementation to use as the internal storage and the Set implementation to use as values.
Modifier | Constructor and Description |
---|---|
protected |
AbstractSetValuedMap()
Constructor needed for subclass serialisation.
|
protected |
AbstractSetValuedMap(Map<K,? extends Set<V>> map)
A constructor that wraps, not copies
|
Modifier and Type | Method and Description |
---|---|
protected abstract Set<V> |
createCollection()
Creates a new value collection using the provided factory.
|
Set<V> |
get(K key)
Gets the set of values associated with the specified key.
|
protected Map<K,Set<V>> |
getMap()
Gets the map being wrapped.
|
Set<V> |
remove(Object key)
Removes all values associated with the specified key.
|
asMap, clear, containsKey, containsMapping, containsValue, doReadObject, doWriteObject, entries, equals, hashCode, isEmpty, keys, keySet, mapIterator, put, putAll, putAll, putAll, removeMapping, setMap, size, toString, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
asMap, clear, containsKey, containsMapping, containsValue, entries, isEmpty, keys, keySet, mapIterator, put, putAll, putAll, putAll, removeMapping, size, values
protected AbstractSetValuedMap()
protected AbstractSetValuedMap(Map<K,? extends Set<V>> map)
map
- the map to wrap, must not be nullNullPointerException
- if the map is nullprotected Map<K,Set<V>> getMap()
AbstractMultiValuedMap
getMap
in class AbstractMultiValuedMap<K,V>
protected abstract Set<V> createCollection()
createCollection
in class AbstractMultiValuedMap<K,V>
public Set<V> get(K key)
get
in interface MultiValuedMap<K,V>
get
in interface SetValuedMap<K,V>
get
in class AbstractMultiValuedMap<K,V>
key
- the key to retrieveSet
of values, will return an empty
Set
for no mappingpublic Set<V> remove(Object key)
A subsequent get(Object)
would return an empty set.
remove
in interface MultiValuedMap<K,V>
remove
in interface SetValuedMap<K,V>
remove
in class AbstractMultiValuedMap<K,V>
key
- the key to remove values fromSet
of values removed, will return an empty,
unmodifiable set for no mapping found.Copyright © 2001–2018 The Apache Software Foundation. All rights reserved.