Module javafx.base

Class MapChangeListener.Change<K,​V>

  • Type Parameters:
    K - key type
    V - value 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.
    JavaFX 2.0
    • Constructor Detail

      • Change

        public Change​(ObservableMap<K,​V> map)
        Constructs a change associated with a map.
        map - the source of the change
    • Method Detail

      • getMap

        public ObservableMap<K,​V> getMap()
        An observable map that is associated with the change.
        the source map
      • wasAdded

        public abstract boolean wasAdded()
        If this change is a result of add operation.
        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.
        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.
        the key that changed
      • getValueAdded

        public abstract V getValueAdded()
        Get the new value of the key. Return null if this is a removal.
        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.
        the value previously associated with the key