Package com.norconex.commons.lang.map
Class ObservableMap<K,V>
java.lang.Object
com.norconex.commons.lang.map.ObservableMap<K,V>
- Type Parameters:
K- the type of keys maintained by the map we are observingV- the type of mapped values
- All Implemented Interfaces:
Serializable,Map<K,V>
- Direct Known Subclasses:
Properties
A map implementation that reports changes to added
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.- Since:
- 1.4
- Author:
- Pascal Essiembre
- See Also:
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMapChangeListener(IMapChangeListener<K, V> listener) Adds a map change listener.voidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanisEmpty()keySet()voidvoidremoveMapChangeListener(IMapChangeListener<K, V> listener) Removes a map change listener.intsize()toString()values()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
ObservableMap
public ObservableMap() -
ObservableMap
Decorates map argument as anObservableMap.- Parameters:
map- the Map to decorate
-
-
Method Details
-
addMapChangeListener
Adds a map change listener.- Parameters:
listener- change listener
-
removeMapChangeListener
Removes a map change listener.- Parameters:
listener- change listener
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
toString
-