Class UnmodifiableOrderedBidiMap
- java.lang.Object
-
- org.apache.commons.collections.map.AbstractMapDecorator
-
- org.apache.commons.collections.bidimap.AbstractBidiMapDecorator
-
- org.apache.commons.collections.bidimap.AbstractOrderedBidiMapDecorator
-
- org.apache.commons.collections.bidimap.UnmodifiableOrderedBidiMap
-
- All Implemented Interfaces:
java.util.Map
,BidiMap
,IterableMap
,OrderedBidiMap
,OrderedMap
,Unmodifiable
@Deprecated(since="2021-04-30") public final class UnmodifiableOrderedBidiMap extends AbstractOrderedBidiMapDecorator implements Unmodifiable
Deprecated.Commons Collections 3 is in maintenance mode. Commons Collections 4 should be used instead.Decorates anotherOrderedBidiMap
to ensure it can't be altered.- Since:
- Commons Collections 3.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
clear()
Deprecated.static OrderedBidiMap
decorate(OrderedBidiMap map)
Deprecated.Factory method to create an unmodifiable map.java.util.Set
entrySet()
Deprecated.BidiMap
inverseBidiMap()
Deprecated.Gets a view of this map where the keys and values are reversed.OrderedBidiMap
inverseOrderedBidiMap()
Deprecated.Gets a view of this map where the keys and values are reversed.java.util.Set
keySet()
Deprecated.MapIterator
mapIterator()
Deprecated.Obtains aMapIterator
over the map.OrderedMapIterator
orderedMapIterator()
Deprecated.Obtains anOrderedMapIterator
over the map.java.lang.Object
put(java.lang.Object key, java.lang.Object value)
Deprecated.Puts the key-value pair into the map, replacing any previous pair.void
putAll(java.util.Map mapToCopy)
Deprecated.java.lang.Object
remove(java.lang.Object key)
Deprecated.java.lang.Object
removeValue(java.lang.Object value)
Deprecated.Removes the key-value pair that is currently mapped to the specified value (optional operation).java.util.Collection
values()
Deprecated.-
Methods inherited from class org.apache.commons.collections.bidimap.AbstractOrderedBidiMapDecorator
firstKey, lastKey, nextKey, previousKey
-
Methods inherited from class org.apache.commons.collections.bidimap.AbstractBidiMapDecorator
getKey
-
Methods inherited from class org.apache.commons.collections.map.AbstractMapDecorator
containsKey, containsValue, equals, get, hashCode, isEmpty, size, toString
-
-
-
-
Method Detail
-
decorate
public static OrderedBidiMap decorate(OrderedBidiMap map)
Deprecated.Factory method to create an unmodifiable map.If the map passed in is already unmodifiable, it is returned.
- Parameters:
map
- the map to decorate, must not be null- Returns:
- an unmodifiable OrderedBidiMap
- Throws:
java.lang.IllegalArgumentException
- if map is null
-
clear
public void clear()
Deprecated.- Specified by:
clear
in interfacejava.util.Map
- Overrides:
clear
in classAbstractMapDecorator
-
put
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
Deprecated.Description copied from interface:BidiMap
Puts 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
- Specified by:
put
in interfaceBidiMap
- Specified by:
put
in interfacejava.util.Map
- Overrides:
put
in classAbstractMapDecorator
- Parameters:
key
- the key to storevalue
- the value to store- Returns:
- the previous value mapped to this key
-
putAll
public void putAll(java.util.Map mapToCopy)
Deprecated.- Specified by:
putAll
in interfacejava.util.Map
- Overrides:
putAll
in classAbstractMapDecorator
-
remove
public java.lang.Object remove(java.lang.Object key)
Deprecated.- Specified by:
remove
in interfacejava.util.Map
- Overrides:
remove
in classAbstractMapDecorator
-
entrySet
public java.util.Set entrySet()
Deprecated.- Specified by:
entrySet
in interfacejava.util.Map
- Overrides:
entrySet
in classAbstractMapDecorator
-
keySet
public java.util.Set keySet()
Deprecated.- Specified by:
keySet
in interfacejava.util.Map
- Overrides:
keySet
in classAbstractMapDecorator
-
values
public java.util.Collection values()
Deprecated.- Specified by:
values
in interfacejava.util.Map
- Overrides:
values
in classAbstractMapDecorator
-
removeValue
public java.lang.Object removeValue(java.lang.Object value)
Deprecated.Description copied from interface:BidiMap
Removes the key-value pair that is currently mapped to the specified value (optional operation).If the value is not contained in the map,
null
is returned.Implementations should seek to make this method perform equally as well as
remove(Object)
.- Specified by:
removeValue
in interfaceBidiMap
- Overrides:
removeValue
in classAbstractBidiMapDecorator
- Parameters:
value
- the value to find the key-value pair for- Returns:
- the key that was removed,
null
if nothing removed
-
mapIterator
public MapIterator mapIterator()
Deprecated.Description copied from interface:BidiMap
Obtains aMapIterator
over the map.A map iterator is an efficient way of iterating over maps. It does not require that the map is stored using Map Entry objects which can increase performance.
BidiMap map = new DualHashBidiMap(); MapIterator it = map.mapIterator(); while (it.hasNext()) { Object key = it.next(); Object value = it.getValue(); it.setValue("newValue"); }
- Specified by:
mapIterator
in interfaceBidiMap
- Specified by:
mapIterator
in interfaceIterableMap
- Overrides:
mapIterator
in classAbstractBidiMapDecorator
- Returns:
- a map iterator
-
inverseBidiMap
public BidiMap inverseBidiMap()
Deprecated.Description copied from interface:BidiMap
Gets 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:
inverseBidiMap
in interfaceBidiMap
- Specified by:
inverseBidiMap
in interfaceOrderedBidiMap
- Overrides:
inverseBidiMap
in classAbstractBidiMapDecorator
- Returns:
- an inverted bidirectional map
-
orderedMapIterator
public OrderedMapIterator orderedMapIterator()
Deprecated.Description copied from interface:OrderedMap
Obtains anOrderedMapIterator
over the map.A ordered map iterator is an efficient way of iterating over maps in both directions.
BidiMap map = new TreeBidiMap(); MapIterator it = map.mapIterator(); while (it.hasNext()) { Object key = it.next(); Object value = it.getValue(); it.setValue("newValue"); Object previousKey = it.previous(); }
- Specified by:
orderedMapIterator
in interfaceOrderedMap
- Overrides:
orderedMapIterator
in classAbstractOrderedBidiMapDecorator
- Returns:
- a map iterator
-
inverseOrderedBidiMap
public OrderedBidiMap inverseOrderedBidiMap()
Deprecated.Description copied from interface:OrderedBidiMap
Gets 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 equally.
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:
inverseOrderedBidiMap
in interfaceOrderedBidiMap
- Overrides:
inverseOrderedBidiMap
in classAbstractOrderedBidiMapDecorator
- Returns:
- an inverted bidirectional map
-
-