Class UnmodifiableSortedBidiMap
- All Implemented Interfaces:
Map,SequencedMap,SortedMap,BidiMap,IterableMap,OrderedBidiMap,OrderedMap,SortedBidiMap,Unmodifiable
SortedBidiMap to ensure it can't be altered.- Since:
- Commons Collections 3.0
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Deprecated.static SortedBidiMapdecorate(SortedBidiMap map) Deprecated.Factory method to create an unmodifiable map.entrySet()Deprecated.Deprecated.Deprecated.Gets a view of this map where the keys and values are reversed.Deprecated.Gets a view of this map where the keys and values are reversed.Deprecated.Gets a view of this map where the keys and values are reversed.keySet()Deprecated.Deprecated.Obtains aMapIteratorover the map.Deprecated.Obtains anOrderedMapIteratorover 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).Deprecated.Deprecated.values()Deprecated.Methods inherited from class org.apache.commons.collections.bidimap.AbstractSortedBidiMapDecorator
comparatorMethods inherited from class org.apache.commons.collections.bidimap.AbstractOrderedBidiMapDecorator
firstKey, lastKey, nextKey, previousKeyMethods inherited from class org.apache.commons.collections.bidimap.AbstractBidiMapDecorator
getKeyMethods inherited from class org.apache.commons.collections.map.AbstractMapDecorator
containsKey, containsValue, equals, get, hashCode, isEmpty, size, toStringMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, putIfAbsent, remove, replace, replace, replaceAll, sizeMethods inherited from interface org.apache.commons.collections.OrderedMap
firstKey, lastKey, nextKey, previousKeyMethods inherited from interface java.util.SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry, sequencedEntrySet, sequencedKeySet, sequencedValues
-
Method Details
-
decorate
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 SortedBidiMap
- Throws:
IllegalArgumentException- if map is null
-
clear
public void clear()Deprecated.- Specified by:
clearin interfaceMap- Overrides:
clearin classAbstractMapDecorator
-
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.- Specified by:
putAllin interfaceMap- Overrides:
putAllin classAbstractMapDecorator
-
remove
Deprecated.- Specified by:
removein interfaceMap- Overrides:
removein classAbstractMapDecorator
-
entrySet
Deprecated. -
keySet
Deprecated. -
values
Deprecated. -
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- Overrides:
removeValuein classAbstractBidiMapDecorator- Parameters:
value- the value to find the key-value pair for- Returns:
- the key that was removed,
nullif nothing removed
-
mapIterator
Deprecated.Description copied from interface:BidiMapObtains aMapIteratorover 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:
mapIteratorin interfaceBidiMap- Specified by:
mapIteratorin interfaceIterableMap- Overrides:
mapIteratorin classAbstractBidiMapDecorator- Returns:
- a map iterator
-
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- Specified by:
inverseBidiMapin interfaceOrderedBidiMap- Specified by:
inverseBidiMapin interfaceSortedBidiMap- Overrides:
inverseBidiMapin classAbstractBidiMapDecorator- Returns:
- an inverted bidirectional map
-
orderedMapIterator
Deprecated.Description copied from interface:OrderedMapObtains anOrderedMapIteratorover 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:
orderedMapIteratorin interfaceOrderedMap- Overrides:
orderedMapIteratorin classAbstractOrderedBidiMapDecorator- Returns:
- a map iterator
-
inverseOrderedBidiMap
Deprecated.Description copied from interface:OrderedBidiMapGets 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:
inverseOrderedBidiMapin interfaceOrderedBidiMap- Overrides:
inverseOrderedBidiMapin classAbstractOrderedBidiMapDecorator- Returns:
- an inverted bidirectional map
-
inverseSortedBidiMap
Deprecated.Description copied from interface:SortedBidiMapGets 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
SortedMap.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.The inverse map returned by
inverseBidiMap()should be the same object as returned by this method.- Specified by:
inverseSortedBidiMapin interfaceSortedBidiMap- Overrides:
inverseSortedBidiMapin classAbstractSortedBidiMapDecorator- Returns:
- an inverted bidirectional map
-
subMap
Deprecated.- Specified by:
subMapin interfaceSortedMap- Overrides:
subMapin classAbstractSortedBidiMapDecorator
-
headMap
Deprecated.- Specified by:
headMapin interfaceSortedMap- Overrides:
headMapin classAbstractSortedBidiMapDecorator
-
tailMap
Deprecated.- Specified by:
tailMapin interfaceSortedMap- Overrides:
tailMapin classAbstractSortedBidiMapDecorator
-