MapChangeListener.Change (JavaFX 13)

Module javafx.base
Package javafx.collections

## Class MapChangeListener.Change<K,​V>

- java.lang.Object
- - javafx.collections.MapChangeListener.Change<K,​V>

- Type Parameters:
    `K` - key type
    `V` - value type
  Enclosing interface:
    MapChangeListener<K,​V>

      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 | Description
    --- | ---
    `Change​(ObservableMap<K,​V> map)` | Constructs a change associated with a map.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract K` | `getKey()` | A key associated with the change.
    `ObservableMap<K,​V>` | `getMap()` | An observable map that is associated with the change.
    `abstract V` | `getValueAdded()` | Get the new value of the key.
    `abstract V` | `getValueRemoved()` | Get the old value of the key.
    `abstract boolean` | `wasAdded()` | If this change is a result of add operation.
    `abstract boolean` | `wasRemoved()` | If this change is a result of removal operation.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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