Class AbstractDualBidiMap
- All Implemented Interfaces:
Map,BidiMap,IterableMap
- Direct Known Subclasses:
DualHashBidiMap,DualTreeBidiMap
BidiMap implemented using two maps.
An implementation can be written simply by implementing the
createMap method.
- Since:
- Commons Collections 3.0
- See Also:
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Deprecated.booleancontainsKey(Object key) Deprecated.booleancontainsValue(Object value) Deprecated.entrySet()Deprecated.Gets an entrySet view of the map.booleanDeprecated.Deprecated.Deprecated.Gets the key that is currently mapped to the specified value.inthashCode()Deprecated.Deprecated.Gets a view of this map where the keys and values are reversed.booleanisEmpty()Deprecated.keySet()Deprecated.Gets a keySet view of the map.Deprecated.Obtains aMapIteratorover the map.Deprecated.Puts the key-value pair into the map, replacing any previous pair.voidDeprecated.Deprecated.removeValue(Object value) Deprecated.Removes the key-value pair that is currently mapped to the specified value (optional operation).intsize()Deprecated.toString()Deprecated.values()Deprecated.Gets a values view of the map.Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Method Details
-
get
Deprecated. -
size
public int size()Deprecated. -
isEmpty
public boolean isEmpty()Deprecated. -
containsKey
Deprecated.- Specified by:
containsKeyin interfaceMap
-
equals
Deprecated. -
hashCode
public int hashCode()Deprecated. -
toString
Deprecated. -
put
Deprecated.Description copied from interface:BidiMapPuts the key-value pair into the map, replacing any previous pair.When adding a key-value pair, the value may already exist in the map against a different key. That mapping is removed, to ensure that the value only occurs once in the inverse map.
BidiMap map1 = new DualHashBidiMap(); map.put("A","B"); // contains A mapped to B, as per Map map.put("A","C"); // contains A mapped to C, as per Map BidiMap map2 = new DualHashBidiMap(); map.put("A","B"); // contains A mapped to B, as per Map map.put("C","B"); // contains C mapped to B, key A is removed -
putAll
Deprecated. -
remove
Deprecated. -
clear
public void clear()Deprecated. -
containsValue
Deprecated.- Specified by:
containsValuein interfaceMap
-
mapIterator
Deprecated.Obtains aMapIteratorover the map. The iterator implementsResetableMapIterator. This implementation relies on the entrySet iterator.The setValue() methods only allow a new value to be set. If the value being set is already in the map, an IllegalArgumentException is thrown (as setValue cannot change the size of the map).
- Specified by:
mapIteratorin interfaceBidiMap- Specified by:
mapIteratorin interfaceIterableMap- Returns:
- a map iterator
-
getKey
Deprecated.Description copied from interface:BidiMapGets the key that is currently mapped to the specified value.If the value is not contained in the map,
nullis returned.Implementations should seek to make this method perform equally as well as
get(Object). -
removeValue
Deprecated.Description copied from interface:BidiMapRemoves the key-value pair that is currently mapped to the specified value (optional operation).If the value is not contained in the map,
nullis returned.Implementations should seek to make this method perform equally as well as
remove(Object).- Specified by:
removeValuein interfaceBidiMap- Parameters:
value- the value to find the key-value pair for- Returns:
- the key that was removed,
nullif nothing removed
-
inverseBidiMap
Deprecated.Description copied from interface:BidiMapGets a view of this map where the keys and values are reversed.Changes to one map will be visible in the other and vice versa. This enables both directions of the map to be accessed as a
Map.Implementations should seek to avoid creating a new object every time this method is called. See
AbstractMap.values()etc. Calling this method on the inverse map should return the original.- Specified by:
inverseBidiMapin interfaceBidiMap- Returns:
- an inverted bidirectional map
-
keySet
Deprecated.Gets a keySet view of the map. Changes made on the view are reflected in the map. The set supports remove and clear but not add. -
values
Deprecated.Gets a values view of the map. Changes made on the view are reflected in the map. The set supports remove and clear but not add. -
entrySet
Deprecated.Gets an entrySet view of the map. Changes made on the set are reflected in the map. The set supports remove and clear but not add.The Map Entry setValue() method only allow a new value to be set. If the value being set is already in the map, an IllegalArgumentException is thrown (as setValue cannot change the size of the map).
-