public final class UnmodifiableOrderedBidiMap extends AbstractOrderedBidiMapDecorator implements Unmodifiable
OrderedBidiMap to ensure it can't be altered.map| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
static OrderedBidiMap |
decorate(OrderedBidiMap map)
Factory method to create an unmodifiable map.
|
Set |
entrySet() |
BidiMap |
inverseBidiMap()
Gets a view of this map where the keys and values are reversed.
|
OrderedBidiMap |
inverseOrderedBidiMap()
Gets a view of this map where the keys and values are reversed.
|
Set |
keySet() |
MapIterator |
mapIterator()
Obtains a
MapIterator over the map. |
OrderedMapIterator |
orderedMapIterator()
Obtains an
OrderedMapIterator over the map. |
Object |
put(Object key,
Object value)
Puts the key-value pair into the map, replacing any previous pair.
|
void |
putAll(Map mapToCopy) |
Object |
remove(Object key) |
Object |
removeValue(Object value)
Removes the key-value pair that is currently mapped to the specified
value (optional operation).
|
Collection |
values() |
firstKey, getOrderedBidiMap, lastKey, nextKey, previousKeygetBidiMap, getKeycontainsKey, containsValue, equals, get, getMap, hashCode, isEmpty, size, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitcontainsKey, containsValue, equals, get, hashCode, isEmpty, sizepublic static OrderedBidiMap decorate(OrderedBidiMap map)
If the map passed in is already unmodifiable, it is returned.
map - the map to decorate, must not be nullIllegalArgumentException - if map is nullpublic void clear()
clear in interface Mapclear in class AbstractMapDecoratorpublic Object put(Object key, Object value)
BidiMapWhen 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
public void putAll(Map mapToCopy)
putAll in interface MapputAll in class AbstractMapDecoratorpublic Object remove(Object key)
remove in interface Mapremove in class AbstractMapDecoratorpublic Set entrySet()
entrySet in interface MapentrySet in class AbstractMapDecoratorpublic Set keySet()
keySet in interface MapkeySet in class AbstractMapDecoratorpublic Collection values()
values in interface Mapvalues in class AbstractMapDecoratorpublic Object removeValue(Object value)
BidiMap
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).
removeValue in interface BidiMapremoveValue in class AbstractBidiMapDecoratorvalue - the value to find the key-value pair fornull if nothing removedpublic MapIterator mapIterator()
BidiMapMapIterator 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");
}
mapIterator in interface BidiMapmapIterator in interface IterableMapmapIterator in class AbstractBidiMapDecoratorpublic BidiMap inverseBidiMap()
BidiMap
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.
inverseBidiMap in interface BidiMapinverseBidiMap in interface OrderedBidiMapinverseBidiMap in class AbstractBidiMapDecoratorpublic OrderedMapIterator orderedMapIterator()
OrderedMapOrderedMapIterator 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();
}
orderedMapIterator in interface OrderedMaporderedMapIterator in class AbstractOrderedBidiMapDecoratorpublic OrderedBidiMap inverseOrderedBidiMap()
OrderedBidiMapChanges 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.
inverseOrderedBidiMap in interface OrderedBidiMapinverseOrderedBidiMap in class AbstractOrderedBidiMapDecoratorCopyright © 2001–2015 The Apache Software Foundation. All rights reserved.