|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.collections4.map.AbstractIterableMap<K,V>
org.apache.commons.collections4.map.AbstractMapDecorator<K,V>
org.apache.commons.collections4.bidimap.AbstractBidiMapDecorator<K,V>
org.apache.commons.collections4.bidimap.AbstractOrderedBidiMapDecorator<K,V>
org.apache.commons.collections4.bidimap.UnmodifiableOrderedBidiMap<K,V>
public final class UnmodifiableOrderedBidiMap<K,V>
Decorates another OrderedBidiMap
to ensure it can't be altered.
Attempts to modify it will result in an UnsupportedOperationException.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Method Summary | ||
---|---|---|
void |
clear()
|
|
Set<Map.Entry<K,V>> |
entrySet()
|
|
OrderedBidiMap<V,K> |
inverseBidiMap()
Gets a view of this map where the keys and values are reversed. |
|
OrderedBidiMap<V,K> |
inverseOrderedBidiMap()
Gets an unmodifiable view of this map where the keys and values are reversed. |
|
Set<K> |
keySet()
|
|
OrderedMapIterator<K,V> |
mapIterator()
Obtains a MapIterator over the map. |
|
V |
put(K key,
V value)
Note that the return type is Object, rather than V as in the Map interface. |
|
void |
putAll(Map<? extends K,? extends V> mapToCopy)
|
|
V |
remove(Object key)
|
|
K |
removeValue(Object value)
Removes the key-value pair that is currently mapped to the specified value (optional operation). |
|
static
|
unmodifiableOrderedBidiMap(OrderedBidiMap<K,V> map)
Factory method to create an unmodifiable map. |
|
Collection<V> |
values()
|
Methods inherited from class org.apache.commons.collections4.bidimap.AbstractOrderedBidiMapDecorator |
---|
decorated, firstKey, lastKey, nextKey, previousKey |
Methods inherited from class org.apache.commons.collections4.bidimap.AbstractBidiMapDecorator |
---|
getKey |
Methods inherited from class org.apache.commons.collections4.map.AbstractMapDecorator |
---|
containsKey, containsValue, equals, get, hashCode, isEmpty, size, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.commons.collections4.BidiMap |
---|
getKey |
Methods inherited from interface java.util.Map |
---|
containsKey, containsValue, equals, get, hashCode, isEmpty, size |
Methods inherited from interface org.apache.commons.collections4.Get |
---|
containsKey, containsValue, get, isEmpty, size |
Methods inherited from interface java.util.Map |
---|
containsKey, containsValue, equals, get, hashCode, isEmpty, size |
Methods inherited from interface org.apache.commons.collections4.Get |
---|
containsKey, containsValue, get, isEmpty, size |
Method Detail |
---|
public static <K,V> OrderedBidiMap<K,V> unmodifiableOrderedBidiMap(OrderedBidiMap<K,V> map)
If the map passed in is already unmodifiable, it is returned.
K
- the key typeV
- the value typemap
- the map to decorate, must not be null
IllegalArgumentException
- if map is nullpublic void clear()
clear
in interface Map<K,V>
clear
in interface Put<K,V>
clear
in class AbstractMapDecorator<K,V>
Map.clear()
public V put(K key, V value)
Put
put
in interface Map<K,V>
put
in interface BidiMap<K,V>
put
in interface Put<K,V>
put
in class AbstractMapDecorator<K,V>
key
- the key to storevalue
- the value to store
Map.put(Object, Object)
public void putAll(Map<? extends K,? extends V> mapToCopy)
putAll
in interface Map<K,V>
putAll
in interface Put<K,V>
putAll
in class AbstractMapDecorator<K,V>
Map.putAll(Map)
public V remove(Object key)
remove
in interface Map<K,V>
remove
in interface Get<K,V>
remove
in class AbstractMapDecorator<K,V>
Map.remove(Object)
public Set<Map.Entry<K,V>> entrySet()
entrySet
in interface Map<K,V>
entrySet
in interface Get<K,V>
entrySet
in class AbstractMapDecorator<K,V>
Map.entrySet()
public Set<K> keySet()
keySet
in interface Map<K,V>
keySet
in interface Get<K,V>
keySet
in class AbstractMapDecorator<K,V>
Map.keySet()
public Collection<V> values()
values
in interface Map<K,V>
values
in interface Get<K,V>
values
in class AbstractMapDecorator<K,V>
Map.values()
public K 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 BidiMap<K,V>
removeValue
in class AbstractBidiMapDecorator<K,V>
value
- the value to find the key-value pair for
null
if nothing removedpublic OrderedBidiMap<V,K> 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 BidiMap<K,V>
inverseBidiMap
in interface OrderedBidiMap<K,V>
inverseBidiMap
in class AbstractOrderedBidiMapDecorator<K,V>
public OrderedMapIterator<K,V> mapIterator()
AbstractIterableMap
MapIterator
over the map.
A map iterator is an efficient way of iterating over maps. There is no need to access the entry set or use Map Entry objects.
IterableMapmap = new HashedMap (); MapIterator it = map.mapIterator(); while (it.hasNext()) { String key = it.next(); Integer value = it.getValue(); it.setValue(value + 1); }
mapIterator
in interface IterableGet<K,V>
mapIterator
in interface OrderedMap<K,V>
mapIterator
in class AbstractOrderedBidiMapDecorator<K,V>
public OrderedBidiMap<V,K> inverseOrderedBidiMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |