|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
net.sf.molae.pipe.basic.AbstractMapWithSet<K,V>
net.sf.molae.pipe.trafo.EntryTransformedMap<Map.Entry<V,K>,K,V>
net.sf.molae.pipe.trafo.InvertedMap<K,V>
public final class InvertedMap<K,V>
A map that exchanges keys and values for each entry. Before using this class, it must be ensured, that values are unique in the base map. Note that this class has a bad performance in general. Therefore it is recommended to store the result in another map.
MapAsTransformer| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class net.sf.molae.pipe.basic.AbstractMapWithSet |
|---|
AbstractMapWithSet.EntrySet |
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
InvertedMap(Map<V,K> m)
Constructs an InvertedMap object. |
|
| Method Summary | |
|---|---|
boolean |
containsKey(Object key)
Returns true if this map contains a mapping for the
specified key. |
boolean |
containsValue(Object value)
Returns true if this map maps a key to
the specified value. |
protected TwoWayTransformer<Map.Entry<V,K>,Map.Entry<K,V>> |
getTransformer()
Returns the underlying transformer. |
static boolean |
isInvertible(Map<?,?> m)
Checks that no value occurs twice in the specified map. |
Set<K> |
keySet()
Returns a set view of the keys contained in this map. |
Collection<V> |
values()
Returns a collection view of the values contained in this map. |
| Methods inherited from class net.sf.molae.pipe.trafo.EntryTransformedMap |
|---|
clear, getEntrySetIterator, size |
| Methods inherited from class net.sf.molae.pipe.basic.AbstractMapWithSet |
|---|
entrySet |
| Methods inherited from class java.util.AbstractMap |
|---|
clone, equals, get, hashCode, isEmpty, put, putAll, remove, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public InvertedMap(Map<V,K> m)
m - underlying map.
NullPointerException - if any of the specified objects is
null.| Method Detail |
|---|
protected TwoWayTransformer<Map.Entry<V,K>,Map.Entry<K,V>> getTransformer()
EntryTransformedMap
getTransformer in class EntryTransformedMap<Map.Entry<V,K>,K,V>public boolean containsKey(Object key)
true if this map contains a mapping for the
specified key.
This is the case if the base map contains the specified key as a
value.
containsKey in interface Map<K,V>containsKey in class AbstractMap<K,V>key - key whose presence in this map is to be tested.
true if this map contains a mapping for the
specified key.public boolean containsValue(Object value)
true if this map maps a key to
the specified value.
This is the case if the base map contains the specified value as a
key.
containsValue in interface Map<K,V>containsValue in class AbstractMap<K,V>value - value whose presence in this map is to be tested.
true if this map maps a key to
the specified valuepublic Set<K> keySet()
values() of the
base map.
keySet in interface Map<K,V>keySet in class AbstractMapWithSet<K,V>public Collection<V> values()
keySet() of the base map.
values in interface Map<K,V>values in class AbstractMap<K,V>public static boolean isInvertible(Map<?,?> m)
m - the map to be examined.
m corresponds to a unique
key.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||