OrderedBidiMap to ensure it can't be altered.
Attempts to modify it will result in an UnsupportedOperationException.
| Modifier and Type | Field and Description |
|---|---|
| private UnmodifiableOrderedBidiMap | inverse
The inverse unmodifiable map |
| Access | Constructor and Description |
|---|---|
| private | UnmodifiableOrderedBidiMap(final OrderedBidiMap<? extends K, ? extends V>
the map to decorate, must not be null map)Constructor that wraps (not copies). |
| inverse | back to summary |
|---|---|
| private UnmodifiableOrderedBidiMap<V, K> inverse The inverse unmodifiable map | |
| UnmodifiableOrderedBidiMap | back to summary |
|---|---|
| private UnmodifiableOrderedBidiMap(final OrderedBidiMap<? extends K, ? extends V> map) Constructor that wraps (not copies).
| |
| clear | back to summary |
|---|---|
| public void clear() Overrides org. Implements java. Doc from java. Removes all of the mappings from this map (optional operation). The map will be empty after this call returns.
| |
| entrySet | back to summary |
|---|---|
| public Set Overrides org. Implements java. Doc from java. Returns a | |
| inverseBidiMap | back to summary |
|---|---|
| public OrderedBidiMap Overrides org. Implements org. Doc from org. 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
Implementations must return an
| |
| inverseOrderedBidiMap | back to summary |
|---|---|
| public OrderedBidiMap Gets an unmodifiable view of this map where the keys and values are reversed.
| |
| keySet | back to summary |
|---|---|
| public Set Overrides org. Implements java. Doc from java. Returns a | |
| mapIterator | back to summary |
|---|---|
| public OrderedMapIterator Overrides org. Implements org. Doc from org. Obtains an A ordered map iterator is an efficient way of iterating over maps in both directions.
| |
| put | back to summary |
|---|---|
| public V put(final K key, final V value) Overrides org. Implements org. Doc from org. 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
| |
| putAll | back to summary |
|---|---|
| public void putAll(final Map<? extends K, ? extends V> mapToCopy) Overrides org. Implements java. Doc from java. Copies all of the mappings from the specified map to this map
(optional operation). The effect of this call is equivalent to that
of calling | |
| remove | back to summary |
|---|---|
| public V remove(final Object key) Overrides org. Implements java. Doc from java. Removes the mapping for a key from this map if it is present
(optional operation). More formally, if this map contains a mapping
from key Returns the value to which this map previously associated the key,
or If this map permits null values, then a return value of
The map will not contain a mapping for the specified key once the call returns. | |
| removeValue | back to summary |
|---|---|
| public K removeValue(final Object value) Overrides org. Implements org. Doc from org. Removes the key-value pair that is currently mapped to the specified value (optional operation).
If the value is not contained in the map,
Implementations should seek to make this method perform equally as well
as | |
| unmodifiableOrderedBidiMap | back to summary |
|---|---|
| public static <K, V> OrderedBidiMap Factory method to create an unmodifiable map. If the map passed in is already unmodifiable, it is returned.
| |
| values | back to summary |
|---|---|
| public Set Overrides org. Implements org. Doc from org. Returns a | |