common
Class MultiMap.EmptyMultiMap
java.lang.Object
java.util.AbstractMap
common.MultiMap.EmptyMultiMap
- All Implemented Interfaces:
- MultiMap, java.util.Map
- Direct Known Subclasses:
- IndexedMultiMap.EmptyIndexedMultiMap
- Enclosing interface:
- MultiMap
public static class MultiMap.EmptyMultiMap
- extends java.util.AbstractMap
- implements MultiMap
Nested classes/interfaces inherited from class java.util.AbstractMap |
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
java.util.Map.Entry<K,V> |
Method Summary |
boolean |
add(java.lang.Object key,
java.lang.Object value)
Adds the given value to the set associated with the given key. |
boolean |
addAll(java.lang.Object key,
java.util.Set values)
Adds all elements of the given set to the set associated with the
given key. |
java.util.Set |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
Returns the set associated with the given key. |
boolean |
remove(java.lang.Object key,
java.lang.Object value)
Removes the given value from the set associated with the given key. |
boolean |
removeAll(java.lang.Object key,
java.util.Set values)
Removes all elements of the given set from the set associated with
the given key. |
Methods inherited from class java.util.AbstractMap |
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, remove, size, values |
MultiMap.EmptyMultiMap
public MultiMap.EmptyMultiMap()
get
public java.lang.Object get(java.lang.Object key)
- Description copied from interface:
MultiMap
- Returns the set associated with the given key. If the key is not
in the map, returns an empty set. The set returned is modifiable and
backed by this multi-map: if values are added for the given key,
they will show up in the returned set. However, the returned set may
lose its connection to this multi-map if the multi-map's
put
method is called or if all the values for the
given key are removed.
- Specified by:
get
in interface MultiMap
- Specified by:
get
in interface java.util.Map
- Overrides:
get
in class java.util.AbstractMap
add
public boolean add(java.lang.Object key,
java.lang.Object value)
- Description copied from interface:
MultiMap
- Adds the given value to the set associated with the given key.
If the key is not yet in the map, it is added.
- Specified by:
add
in interface MultiMap
- Returns:
- true if the MultiMap changed as a result of this call
addAll
public boolean addAll(java.lang.Object key,
java.util.Set values)
- Description copied from interface:
MultiMap
- Adds all elements of the given set to the set associated with the
given key. If the key is not yet in the map, it is added.
- Specified by:
addAll
in interface MultiMap
- Returns:
- true if the MultiMap changed as a result of this call
remove
public boolean remove(java.lang.Object key,
java.lang.Object value)
- Description copied from interface:
MultiMap
- Removes the given value from the set associated with the given key.
Does nothing if the value is not in that set. If the set ends up
being empty, then the key is removed from the map.
- Specified by:
remove
in interface MultiMap
- Returns:
- true if the MultiMap changed as a result of this call
removeAll
public boolean removeAll(java.lang.Object key,
java.util.Set values)
- Description copied from interface:
MultiMap
- Removes all elements of the given set from the set associated with
the given key. If the associated set ends up being empty, then the
key is removed from the map.
- Specified by:
removeAll
in interface MultiMap
- Returns:
- true if the MultiMap changed as a result of this call
entrySet
public java.util.Set entrySet()
- Specified by:
entrySet
in interface java.util.Map
- Specified by:
entrySet
in class java.util.AbstractMap