Top Description Methods
org.apache.commons.collections4

public Interface ListValuedMap<K, V>

extends MultiValuedMap<K, V>
Known Direct Implementers
org.apache.commons.collections4.multimap.AbstractListValuedMap
Type Parameters
<K>
the type of the keys in this map
<V>
the type of the values in this map
Imports
java.util.List

Defines a map that holds a list of values against each key.

A ListValuedMap is a Map with slightly different semantics:

Since
4.1

Method Summary

Modifier and TypeMethod and Description
public List<V>

Returns:

the List of values, implementations should return an empty List for no mapping
get
(K
the key to retrieve
key
)

Redeclares org.apache.commons.collections4.MultiValuedMap.get.

Gets the list of values associated with the specified key.
public List<V>

Returns:

the List of values removed, implementations typically return an empty, unmodifiable List for no mapping found
remove
(Object
the key to remove values from
key
)

Redeclares org.apache.commons.collections4.MultiValuedMap.remove.

Removes all values associated with the specified key.
Inherited from org.apache.commons.collections4.MultiValuedMap:
asMapclearcontainsKeycontainsMappingcontainsValueentriesisEmptykeyskeySetmapIteratorputputAllputAllputAllremoveMappingsizevalues

Method Detail

getback to summary
public List<V> get(K key)

Redeclares org.apache.commons.collections4.MultiValuedMap.get.

Gets the list of values associated with the specified key.

This method will return an empty list if containsKey(Object) returns false. Changes to the returned list will update the underlying ListValuedMap and vice-versa.

Parameters
key:K

the key to retrieve

Returns:List<V>

the List of values, implementations should return an empty List for no mapping

Annotations
@Override
Exceptions
NullPointerException:
if the key is null and null keys are invalid
removeback to summary
public List<V> remove(Object key)

Redeclares org.apache.commons.collections4.MultiValuedMap.remove.

Removes all values associated with the specified key.

The returned list may be modifiable, but updates will not be propagated to this list-valued map. In case no mapping was stored for the specified key, an empty, unmodifiable list will be returned.

Parameters
key:Object

the key to remove values from

Returns:List<V>

the List of values removed, implementations typically return an empty, unmodifiable List for no mapping found

Annotations
@Override
Exceptions
UnsupportedOperationException:
if the map is unmodifiable
NullPointerException:
if the key is null and null keys are invalid