public class LinkMap<K,V> extends AbstractMap<K,V>
values like so:
Map originals = new HashMap();
Map wrapper = new LinkMap(values, originals, LinkMap.Changes.CONSERVE);
wrapper.put(key, value);
Object newValue = values.get(key);
Object originalValue = originals.get(key);
assert originalValue == wrapper.get(key);
Changes on a map can be made temporay by wrapping it like this:
Map wrapper = new LinkMap(values, new HashMap(), LinkMap.Changes.SECOND);
wrapper.put(key, value);
Object newValue = wrapper.get(key);
Object oldValue = values.get(key);
assert value == newValue;
| Modifier and Type | Class and Description |
|---|---|
static class |
LinkMap.Changes
Enum for the parameter of the constructor
LinkMap(Map, Map, Changes) |
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
LinkMap(Map<K,V> m1,
Map<K,V> m2)
Creates an unmodifiable Linked Map
|
LinkMap(Map<K,V> m1,
Map<K,V> m2,
LinkMap.Changes c)
Creates a (modifiable) Linked Map.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(Object key) |
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key) |
static void |
main(String[] args) |
V |
put(K key,
V v) |
int |
size() |
clear, clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, remove, toString, valuesfinalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic LinkMap(Map<K,V> m1, Map<K,V> m2, LinkMap.Changes c)
c parameter.public int size()
public boolean containsKey(Object key)
containsKey in interface Map<K,V>containsKey in class AbstractMap<K,V>public static void main(String[] args)
MMBase 1.9-SNAPSHOT - ${javadoctimestamp}