Module javafx.base
Package javafx.beans.binding

# Class SetExpression<E>

java.lang.Object
javafx.beans.binding.SetExpression<E>

Type Parameters:
  `E` - the type of the `Set` elements

All Implemented Interfaces:
  `Iterable<E>`, `Collection<E>`, `Set<E>`, `Observable`, `ObservableObjectValue<ObservableSet<E>>`, `ObservableSetValue<E>`, `ObservableValue<ObservableSet<E>>`, `ObservableSet<E>`

Direct Known Subclasses:
  `ReadOnlySetProperty`, `SetBinding`

    public abstract class SetExpression<E>
    extends Object
    implements ObservableSetValue<E>

`SetExpression` is an `ObservableSetValue` plus additional convenience methods to generate bindings in a fluent style.

A concrete sub-class of `SetExpression` has to implement the method `ObservableObjectValue.get()`, which provides the actual value of this expression.

If the wrapped list of a `SetExpression` is `null`, all methods implementing the `Set` interface will behave as if they were applied to an immutable empty set.

Since:
  JavaFX 2.1

- ## Property Summary

  Properties
  Type | Property | Description
  --- | --- | ---
  `abstract ReadOnlyBooleanProperty` | `empty` | A boolean property that is `true`, if the set is empty.
  `abstract ReadOnlyIntegerProperty` | `size` | An integer property that represents the size of the set.

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `SetExpression()` | Creates a default `SetExpression`.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `StringBinding` | `asString()` | Creates a `StringBinding` that holds the value of the `SetExpression` turned into a `String`.
  `abstract ReadOnlyBooleanProperty` | `emptyProperty()` | A boolean property that is `true`, if the set is empty.
  `int` | `getSize()` | The size of the set
  `BooleanBinding` | `isEqualTo​(ObservableSet<?> other)` | Creates a new `BooleanBinding` that holds `true` if this set is equal to another `ObservableSet`.
  `BooleanBinding` | `isNotEqualTo​(ObservableSet<?> other)` | Creates a new `BooleanBinding` that holds `true` if this set is not equal to another `ObservableSet`.
  `BooleanBinding` | `isNotNull()` | Creates a new `BooleanBinding` that holds `true` if the wrapped set is not `null`.
  `BooleanBinding` | `isNull()` | Creates a new `BooleanBinding` that holds `true` if the wrapped set is `null`.
  `static <E> SetExpression<E>` | `setExpression​(ObservableSetValue<E> value)` | Returns a `SetExpression` that wraps a `ObservableSetValue`.
  `abstract ReadOnlyIntegerProperty` | `sizeProperty()` | An integer property that represents the size of the set.

  ### Methods declared in class java.lang.Object

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

  ### Methods declared in interface java.util.Collection

  `parallelStream, removeIf, stream, toArray`

  ### Methods declared in interface java.lang.Iterable

  `forEach`

  ### Methods declared in interface javafx.beans.Observable

  `addListener, removeListener`

  ### Methods declared in interface javafx.beans.value.ObservableObjectValue

  `get`

  ### Methods declared in interface javafx.collections.ObservableSet

  `addListener, removeListener`

  ### Methods declared in interface javafx.beans.value.ObservableValue

  `addListener, getValue, removeListener`

  ### Methods declared in interface java.util.Set

  `add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, spliterator, toArray, toArray`

- ## Property Details

  - ### size

    public abstract ReadOnlyIntegerProperty sizeProperty
    An integer property that represents the size of the set.
    See Also:
      `getSize()`

  - ### empty

    public abstract ReadOnlyBooleanProperty emptyProperty
    A boolean property that is `true`, if the set is empty.
    See Also:
      `Set.isEmpty()`

- ## Constructor Details

  - ### SetExpression

    public SetExpression()
    Creates a default `SetExpression`.

- ## Method Details

  - ### setExpression

    public static <E> SetExpression<E> setExpression​(ObservableSetValue<E> value)
    Returns a `SetExpression` that wraps a `ObservableSetValue`. If the `ObservableSetValue` is already a `SetExpression`, it will be returned. Otherwise a new `SetBinding` is created that is bound to the `ObservableSetValue`.
    Type Parameters:
      `E` - the type of the `Set` elements
    Parameters:
      `value` - The source `ObservableSetValue`
    Returns:
      A `SetExpression` that wraps the `ObservableSetValue` if necessary
    Throws:
      `NullPointerException` - if `value` is `null`

  - ### getSize

    public int getSize()
    The size of the set
    Returns:
      the size

  - ### sizeProperty

    public abstract ReadOnlyIntegerProperty sizeProperty()
    An integer property that represents the size of the set.
    See Also:
      `getSize()`

  - ### emptyProperty

    public abstract ReadOnlyBooleanProperty emptyProperty()
    A boolean property that is `true`, if the set is empty.
    See Also:
      `Set.isEmpty()`

  - ### isEqualTo

    public BooleanBinding isEqualTo​(ObservableSet<?> other)
    Creates a new `BooleanBinding` that holds `true` if this set is equal to another `ObservableSet`.
    Parameters:
      `other` - the other `ObservableSet`
    Returns:
      the new `BooleanBinding`
    Throws:
      `NullPointerException` - if `other` is `null`

  - ### isNotEqualTo

    public BooleanBinding isNotEqualTo​(ObservableSet<?> other)
    Creates a new `BooleanBinding` that holds `true` if this set is not equal to another `ObservableSet`.
    Parameters:
      `other` - the other `ObservableSet`
    Returns:
      the new `BooleanBinding`
    Throws:
      `NullPointerException` - if `other` is `null`

  - ### isNull

    public BooleanBinding isNull()
    Creates a new `BooleanBinding` that holds `true` if the wrapped set is `null`.
    Returns:
      the new `BooleanBinding`

  - ### isNotNull

    public BooleanBinding isNotNull()
    Creates a new `BooleanBinding` that holds `true` if the wrapped set is not `null`.
    Returns:
      the new `BooleanBinding`

  - ### asString

    public StringBinding asString()
    Creates a `StringBinding` that holds the value of the `SetExpression` turned into a `String`. If the value of this `SetExpression` changes, the value of the `StringBinding` will be updated automatically.
    Returns:
      the new `StringBinding`