Module javafx.base
Package javafx.collections

# Class SetChangeListener.Change<E>

java.lang.Object
javafx.collections.SetChangeListener.Change<E>

Type Parameters:
  `E` - element type

Enclosing interface:
  `SetChangeListener<E>`

public abstract static class SetChangeListener.Change<E> extends Object
An elementary change done to an ObservableSet. Change contains information about an add or remove operation. Note that adding element that is already in the set does not modify the set and hence no change will be generated.

Since:
  JavaFX 2.1

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Change(ObservableSet<E> set)`
  Constructs a change associated with a set.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract E`
  `getElementAdded()`
  Get the new element.
  `abstract E`
  `getElementRemoved()`
  Get the old element.
  `ObservableSet<E>`
  `getSet()`
  An observable set that is associated with the change.
  `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 declared in class java.lang.Object

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

- ## Constructor Details

  - ### Change

    public Change(ObservableSet<E> set)
    Constructs a change associated with a set.
    Parameters:
      `set` - the source of the change

- ## Method Details

  - ### getSet

    public ObservableSet<E> getSet()
    An observable set that is associated with the change.
    Returns:
      the source set

  - ### wasAdded

    public abstract boolean wasAdded()
    If this change is a result of add operation.
    Returns:
      true if a new element was added to the set

  - ### wasRemoved

    public abstract boolean wasRemoved()
    If this change is a result of removal operation.
    Returns:
      true if an old element was removed from the set

  - ### getElementAdded

    public abstract E getElementAdded()
    Get the new element. Return null if this is a removal.
    Returns:
      the element that was just added

  - ### getElementRemoved

    public abstract E getElementRemoved()
    Get the old element. Return null if this is an addition.
    Returns:
      the element that was just removed