|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface MultiValueMap<K,V>
MultiValueMap is a mapping of one key to multiple values.
Multiple here means zero to many values. This interface is implemented by
mutable and immutable mappings. Immutable mappings throw an
UnsupportedOperationException at mutating methods.
This class is similar to Map, but manages multiple values for the
same key.
| Method Summary | |
|---|---|
boolean |
add(K key,
V value)
Adds the given value to the multi value map |
boolean |
addAll(K key,
Collection<? extends V> values)
Adds the given values to the multi value map |
boolean |
addAll(K key,
V... values)
Adds the given values to the multi value map |
boolean |
addAll(Map<? extends K,? extends V> map)
Adds the key/value map entries of the given map to this multi value map |
boolean |
addAll(MultiValueMap<? extends K,? extends V> mapping)
Adds the key/value-collection entries of the given mapping to this key collection |
boolean |
addAllNested(Map<? extends K,? extends Collection<? extends V>> map)
Adds the key/value-collection entries of the given map to this key collection |
Map<K,? extends Collection<V>> |
asCollectionMap()
Returns a map with keys and collections of values. |
Map<K,V> |
asSingleValueMap()
Returns a map with keys and the first value associated with that key. |
boolean |
clear()
Removes all entries from this mapping |
boolean |
contains(Object key)
Returns true if the value collection is non-empty |
boolean |
contains(Object key,
V value)
Returns true if the value collection contains at least one occurrence of the given value |
int |
count(Object key)
Returns the number of values in the value collection |
Collection<V> |
get(Object key)
Returns a collection for all values belonging to the specified key, or an empty collection if no such key collection exists yet. |
V |
getFirst(Object key)
Returns the first value of the value collection, or null if no such value exists |
MultiValueMap<V,K> |
invert()
Returns an inverted mapping, where the key can be asked knowing the value. |
boolean |
isEmpty()
Returns true if this map is empty |
Set<K> |
keySet()
Returns a set containing all keys. |
int |
keySize()
Returns the number of keys contained in this mapping |
boolean |
remove(Object key)
Returns all values belonging to this key, i.e. |
boolean |
remove(Object key,
V value)
Returns a single value of the value collection, if it exists |
Iterable<V> |
values()
Returns an iterable for all values in this mapping. |
int |
valueSize()
Returns the number of values contained in this mapping |
| Method Detail |
|---|
boolean add(K key,
V value)
key - the key which identifies the value collectionvalue - the value to add
UnsupportedOperationException - if this is an immutable map
boolean addAll(K key,
V... values)
key - the key which identifies the value collectionvalues - the values to add
UnsupportedOperationException - if this is an immutable mapboolean addAll(Map<? extends K,? extends V> map)
map - the map containing key/value-collection entries to add
UnsupportedOperationException - if this is an immutable map
boolean addAll(K key,
Collection<? extends V> values)
key - the key which identifies the value collectionvalues - the values to add
UnsupportedOperationException - if this is an immutable mapboolean addAll(MultiValueMap<? extends K,? extends V> mapping)
mapping - the mapping containing key/value-collection entries to add
UnsupportedOperationException - if this is an immutable mapboolean addAllNested(Map<? extends K,? extends Collection<? extends V>> map)
map - the map containing key/value-collection entries to add
UnsupportedOperationException - if this is an immutable mapboolean remove(Object key)
key - the key which identifies the value collection
UnsupportedOperationException - if this is an immutable map
boolean remove(Object key,
V value)
key - the key which identifies the value collectionvalue - the value to remove
UnsupportedOperationException - if this is an immutable mapboolean clear()
UnsupportedOperationException - if this is an immutable mapCollection<V> get(Object key)
key - the key which identifies the value collection
V getFirst(Object key)
key - the key which identifies the value collection
int count(Object key)
key - the key which identifies the value collection
boolean contains(Object key)
key - the key which identifies the value collection
boolean contains(Object key,
V value)
key - the key which identifies the value collectionvalue - the value to look for
Set<K> keySet()
Iterable<V> values()
Map<K,V> asSingleValueMap()
Changing the returned map might or might not affect this multi value map, depending on the implementation.
MultiValueMap<V,K> invert()
Changing the returned map might or might not affect this multi value map, depending on the implementation.
Map<K,? extends Collection<V>> asCollectionMap()
Changing the returned map might or might not affect this multi value map, depending on the implementation.
int keySize()
int valueSize()
boolean isEmpty()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||