Package org.apache.commons.collections4
Interface SetValuedMap<K,V>
- 
- Type Parameters:
 K- the type of the keys in this mapV- the type of the values in this map
- All Superinterfaces:
 MultiValuedMap<K,V>
- All Known Implementing Classes:
 AbstractSetValuedMap,HashSetValuedHashMap
public interface SetValuedMap<K,V> extends MultiValuedMap<K,V>
Defines a map that holds a set of values against each key.A
SetValuedMapis a Map with slightly different semantics:- Putting a value into the map will add the value to a 
Setat that key. - Getting a value will return a 
Set, holding all the values put to that key. 
- Since:
 - 4.1
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Set<V>get(K key)Gets the set of values associated with the specified key.java.util.Set<V>remove(java.lang.Object key)Removes all values associated with the specified key.- 
Methods inherited from interface org.apache.commons.collections4.MultiValuedMap
asMap, clear, containsKey, containsMapping, containsValue, entries, isEmpty, keys, keySet, mapIterator, put, putAll, putAll, putAll, removeMapping, size, values 
 - 
 
 - 
 
- 
- 
Method Detail
- 
get
java.util.Set<V> get(K key)
Gets the set of values associated with the specified key.Implementations typically return an empty
Setif no values have been mapped to the key.- Specified by:
 getin interfaceMultiValuedMap<K,V>- Parameters:
 key- the key to retrieve- Returns:
 - the 
Setof values, implementations should return an emptySetfor no mapping - Throws:
 java.lang.NullPointerException- if the key is null and null keys are invalid
 
- 
remove
java.util.Set<V> remove(java.lang.Object key)
Removes all values associated with the specified key.The returned set may be modifiable, but updates will not be propagated to this set-valued map. In case no mapping was stored for the specified key, an empty, unmodifiable set will be returned.
- Specified by:
 removein interfaceMultiValuedMap<K,V>- Parameters:
 key- the key to remove values from- Returns:
 - the 
Setof values removed, implementations should return null for no mapping found, but may return an empty collection - Throws:
 java.lang.UnsupportedOperationException- if the map is unmodifiablejava.lang.NullPointerException- if the key is null and null keys are invalid
 
 - 
 
 -