public abstract class AbstractListValuedMap<K,V> extends AbstractMultiValuedMap<K,V> implements ListValuedMap<K,V>
ListValuedMap
interface to simplify
the creation of subclass implementations.
Subclasses specify a Map implementation to use as the internal storage and the List implementation to use as values.
Modifier and Type | Class and Description |
---|---|
private class |
AbstractListValuedMap.ValuesListIterator
Values ListIterator
|
private class |
AbstractListValuedMap.WrappedList
Wrapped list to handle add and remove on the list returned by get(object)
|
AbstractMultiValuedMap.WrappedCollection
Modifier | Constructor and Description |
---|---|
protected |
AbstractListValuedMap()
Constructor needed for subclass serialisation.
|
protected |
AbstractListValuedMap(java.util.Map<K,? extends java.util.List<V>> map)
A constructor that wraps, not copies
|
Modifier and Type | Method and Description |
---|---|
protected abstract java.util.List<V> |
createCollection()
Creates a new value collection using the provided factory.
|
java.util.List<V> |
get(K key)
Gets the list of values associated with the specified key.
|
protected java.util.Map<K,java.util.List<V>> |
getMap()
Gets the map being wrapped.
|
java.util.List<V> |
remove(java.lang.Object key)
Removes all values associated with the specified key.
|
(package private) java.util.List<V> |
wrappedCollection(K 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 AbstractListValuedMap()
protected java.util.Map<K,java.util.List<V>> getMap()
AbstractMultiValuedMap
getMap
in class AbstractMultiValuedMap<K,V>
protected abstract java.util.List<V> createCollection()
createCollection
in class AbstractMultiValuedMap<K,V>
public java.util.List<V> get(K key)
get
in interface ListValuedMap<K,V>
get
in interface MultiValuedMap<K,V>
get
in class AbstractMultiValuedMap<K,V>
key
- the key to retrieveList
of values, will return an empty List
for no mappingjava.util.List<V> wrappedCollection(K key)
wrappedCollection
in class AbstractMultiValuedMap<K,V>
public java.util.List<V> remove(java.lang.Object key)
A subsequent get(Object)
would return an empty list.
remove
in interface ListValuedMap<K,V>
remove
in interface MultiValuedMap<K,V>
remove
in class AbstractMultiValuedMap<K,V>
key
- the key to remove values fromList
of values removed, will return an empty,
unmodifiable list for no mapping found.