javafx.collections
Class MapChangeListener.Change<K,V>
- javafx.collections.MapChangeListener.Change<K,V>
Type Parameters:
K - key type
Enclosing interface:
public abstract static class MapChangeListener.Change<K,V> extends Object
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
Constructors Constructor and Description Change(ObservableMap<K,V> map)Constructs a change associated with a map.
-
Method Summary
All MethodsInstance MethodsAbstract MethodsConcrete Methods Modifier and Type Method and Description abstract KgetKey()A key associated with the change.ObservableMap<K,V>getMap()An observable map that is associated with the change.abstract VgetValueAdded()Get the new value of the key.abstract VgetValueRemoved()Get the old value of the key.abstract booleanwasAdded()If this change is a result of add operation.abstract booleanwasRemoved()If this change is a result of removal operation.
-
Constructor Detail
-
Change
public Change(ObservableMap<K,V> map)
Constructs a change associated with a map.Parameters:
map- the source of the change
-
-
Method Detail
-
getMap
public ObservableMap<K,V> 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
public abstract K 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
public abstract V 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
public abstract V 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
-
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.