Package com.globalmentor.collections
Interface ReverseMap<K,V>
-
- Type Parameters:
K
- The type of map key.V
- The type of map value.
- All Superinterfaces:
java.util.Map<K,V>
- All Known Subinterfaces:
ReadWriteLockReverseMap<K,V>
- All Known Implementing Classes:
DecoratorReadWriteLockReverseMap
,DecoratorReverseMap
public interface ReverseMap<K,V> extends java.util.Map<K,V>
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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description K
getKey(V value)
Returns the key that represents the given value.K
removeValue(V value)
Removes the mapping for a value from this map if it is present.
-
-
-
Method Detail
-
getKey
K getKey(V value)
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:
java.lang.ClassCastException
- Thrown if the value is of an inappropriate type for this map (optional).java.lang.NullPointerException
- Thrown if the value isnull
and this map does not not permitnull
values (optional).- See Also:
Map.containsValue(Object)
-
removeValue
K removeValue(V value)
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:
java.lang.UnsupportedOperationException
- if the remove operation is not supported by this mapjava.lang.ClassCastException
- if the value is of an inappropriate type for this map (optional).java.lang.NullPointerException
- if the specified value isnull
and this map does not permitnull
values (optional).
-
-