java.lang.Object
javafx.collections.MapChangeListener.Change<K,V>
- Type Parameters:
K
- key typeV
- value type
- Enclosing interface:
MapChangeListener<K,
V>
An elementary change done to an ObservableMap.
Change contains information about a put or remove operation.
Note that put operation might remove an element if there was
already a value associated with the same key. In this case
wasAdded() and wasRemoved() will both return true.
- Since:
- JavaFX 2.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract K
getKey()
A key associated with the change.getMap()
An observable map that is associated with the change.abstract V
Get the new value of the key.abstract V
Get the old value of the key.abstract boolean
wasAdded()
If this change is a result of add operation.abstract boolean
If this change is a result of removal operation.
-
Constructor Details
-
Change
Constructs a change associated with a map.- Parameters:
map
- the source of the change
-
-
Method Details
-
getMap
An observable map that is associated with the change.- Returns:
- the source map
-
wasAdded
public abstract boolean wasAdded()If this change is a result of add operation.- Returns:
- true if a new value (or key-value) entry was added to the map
-
wasRemoved
public abstract boolean wasRemoved()If this change is a result of removal operation. Note that an element might be removed even as a result of put operation.- Returns:
- true if an old value (or key-value) entry was removed from the map
-
getKey
A key associated with the change. If the change is a remove change, the key no longer exist in a map. Otherwise, the key got set to a new value.- Returns:
- the key that changed
-
getValueAdded
Get the new value of the key. Return null if this is a removal.- Returns:
- the value that is now associated with the key
-
getValueRemoved
Get the old value of the key. This is null if and only if the value was added to the key that was not previously in the map.- Returns:
- the value previously associated with the key
-