org.mmbase.util
Class BijectiveMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.mmbase.util.BijectiveMap<K,V>
- All Implemented Interfaces:
- Serializable, Map<K,V>
public class BijectiveMap<K,V>
- extends AbstractMap<K,V>
- implements Serializable
A map representing a 1-1 bijective relation between 2 sets of values.
So, this map can be turned around (getInverse()). resulting another BijectiveMap, but with keys an values switched.
- Since:
- MMBase-1.9.1
- Version:
- $Id: BijectiveMap.java 41418 2010-03-16 12:53:46Z michiel $
- Author:
- Michiel Meeuwissen
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
| Methods inherited from class java.util.AbstractMap |
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values |
BijectiveMap
public BijectiveMap()
entrySet
public Set<Map.Entry<K,V>> entrySet()
- Specified by:
entrySet in interface Map<K,V>- Specified by:
entrySet in class AbstractMap<K,V>
put
public V put(K key,
V value)
- Specified by:
put in interface Map<K,V>- Overrides:
put in class AbstractMap<K,V>
inverseGet
public K inverseGet(V value)
- Gets a key by value. That this is possible, is the essence of this class.
getInverse
public BijectiveMap<V,K> getInverse()
- Returns view on this map where the keys and values have switched their function.
MMBase 2.0-SNAPSHOT - null