K
- the type of keys maintained by the map we are observingV
- the type of mapped valuespublic class ObservableMap<K,V> extends Object implements Map<K,V>, Serializable
IMapChangeListener
instance. Changes are triggered when a value change is detected
in the following method calls: put(Object, Object)
,
putAll(Map)
, remove(Object)
, and clear()
.
This class will not detect changes made to key or value objects modified
outside this class.
This class can be used as a decorator to other Map
implementations.Constructor and Description |
---|
ObservableMap() |
ObservableMap(Map<K,V> map)
Decorates map argument as an
ObservableMap . |
Modifier and Type | Method and Description |
---|---|
void |
addMapChangeListener(IMapChangeListener<K,V> listener)
Adds a map change listener.
|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key) |
boolean |
isEmpty() |
Set<K> |
keySet() |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> m) |
V |
remove(Object key) |
void |
removeMapChangeListener(IMapChangeListener<K,V> listener)
Removes a map change listener.
|
int |
size() |
String |
toString() |
Collection<V> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
public void addMapChangeListener(IMapChangeListener<K,V> listener)
listener
- change listenerpublic void removeMapChangeListener(IMapChangeListener<K,V> listener)
listener
- change listenerpublic boolean containsKey(Object key)
containsKey
in interface Map<K,V>
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
Copyright © 2008–2021 Norconex Inc.. All rights reserved.