Key - Value - public class ReflexiveMap<Key,Value> extends Object implements Map<Key,Value>
ReflexiveMap aims at providing a Map which support a
bijective relation. In other words, the Value can be considered as a
key for the Key. Such Map can thus be mirrored to be able to
access Keys by providing the corresponding Values. This is
what is supported by the reverse() method.| Constructor and Description |
|---|
ReflexiveMap() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<Key,Value>> |
entrySet() |
protected <K,V> Map<K,V> |
generateInternalMap()
Internally, two different
Maps are used to store the data. |
Value |
get(Object key) |
Key |
getKeyFrom(Value value) |
Value |
getValueFrom(Key key) |
boolean |
isEmpty() |
Set<Key> |
keySet() |
Value |
put(Key key,
Value value) |
void |
putAll(Map<? extends Key,? extends Value> m) |
Value |
remove(Object key) |
ReflexiveMap<Value,Key> |
reverse() |
int |
size() |
String |
toString() |
Collection<Value> |
values() |
protected <K,V> Map<K,V> generateInternalMap()
Maps are used to store the data. Each
update on this ReflexiveMap correspond to an update to both these
internal Maps. You can override this method to change the type of
internal Map used.ReflexiveMappublic boolean containsKey(Object key)
containsKey in interface Map<Key,Value>public boolean containsValue(Object value)
containsValue in interface Map<Key,Value>public ReflexiveMap<Value,Key> reverse()
Copyright © 2014–2015. All rights reserved.