Package com.globalmentor.collections
Interface ReverseMap<K,V>
- Type Parameters:
K
- The type of map key.V
- The type of map value.
- All Superinterfaces:
Map<K,
V>
- All Known Subinterfaces:
ReadWriteLockReverseMap<K,
V>
- All Known Implementing Classes:
DecoratorReadWriteLockReverseMap
,DecoratorReverseMap
A map that also allows lookup of the map keys keyed to the values.
The keys and values in this map have a one-to-one relationship. Associating multiple values with a key will likely result in errant functionality.
- Author:
- Garret Wilson
-
Nested Class Summary
-
Method Summary
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Method Details
-
getKey
Returns the key that represents the given value.- Parameters:
value
- The value whose associated key is to be returned.- Returns:
- The key to which this map reverse maps the specified value, or
null
if the map contains no reverse mapping for this value. - Throws:
ClassCastException
- Thrown if the value is of an inappropriate type for this map (optional).NullPointerException
- Thrown if the value isnull
and this map does not not permitnull
values (optional).- See Also:
-
removeValue
Removes the mapping for a value from this map if it is present.- Parameters:
value
- The value whose mapping is to be removed from the map.- Returns:
- The previous key associated with the value, or
null
if there was no mapping for the value. - Throws:
UnsupportedOperationException
- if the remove operation is not supported by this mapClassCastException
- if the value is of an inappropriate type for this map (optional).NullPointerException
- if the specified value isnull
and this map does not permitnull
values (optional).
-