javafx.beans.binding

## Class ListExpression<E>

- java.lang.Object
- - javafx.beans.binding.ListExpression<E>

- Type Parameters:
    `E` - the type of the `List` elements.
  All Implemented Interfaces:
    Iterable<E>, Collection<E>, List<E>, Observable, ObservableListValue<E>, ObservableObjectValue<ObservableList<E>>, ObservableValue<ObservableList<E>>, ObservableList<E>
  Direct Known Subclasses:
    ListBinding, ReadOnlyListProperty

      public abstract class ListExpression<E>
      extends Object
      implements ObservableListValue<E>

  A `ListExpression` is a `ObservableListValue` plus additional convenience methods to generate bindings in a fluent style.

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

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

  Since:
    JavaFX 2.1

- - ### Property Summary

    All Methods Instance Methods Abstract Methods
    Type | Property and Description
    --- | ---
    `abstract ReadOnlyBooleanProperty` | `empty` A boolean property that is `true`, if the list is empty.
    `abstract ReadOnlyIntegerProperty` | `size` An integer property that represents the size of the list.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ListExpression()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `add(E element)`
    `void` | `add(int i, E element)`
    `boolean` | `addAll(Collection<? extends E> elements)`
    `boolean` | `addAll(E... elements)` A convenient method for var-arg adding of elements.
    `boolean` | `addAll(int i, Collection<? extends E> elements)`
    `StringBinding` | `asString()` Creates a `StringBinding` that holds the value of the `ListExpression` turned into a `String`.
    `void` | `clear()`
    `boolean` | `contains(Object obj)`
    `boolean` | `containsAll(Collection<?> objects)`
    `abstract ReadOnlyBooleanProperty` | `emptyProperty()` A boolean property that is `true`, if the list is empty.
    `E` | `get(int i)`
    `int` | `getSize()` The size of the list
    `ObservableList<E>` | `getValue()` Returns the current value of this `ObservableValue`
    `int` | `indexOf(Object obj)`
    `boolean` | `isEmpty()` Gets the value of the property empty.
    `BooleanBinding` | `isEqualTo(ObservableList<?> other)` Creates a new `BooleanBinding` that holds `true` if this list is equal to another `ObservableList`.
    `BooleanBinding` | `isNotEqualTo(ObservableList<?> other)` Creates a new `BooleanBinding` that holds `true` if this list is not equal to another `ObservableList`.
    `BooleanBinding` | `isNotNull()` Creates a new `BooleanBinding` that holds `true` if the wrapped list is not `null`.
    `BooleanBinding` | `isNull()` Creates a new `BooleanBinding` that holds `true` if the wrapped list is `null`.
    `Iterator<E>` | `iterator()`
    `int` | `lastIndexOf(Object obj)`
    `static <E> ListExpression<E>` | `listExpression(ObservableListValue<E> value)` Returns a `ListExpression` that wraps a `ObservableListValue`.
    `ListIterator<E>` | `listIterator()`
    `ListIterator<E>` | `listIterator(int i)`
    `E` | `remove(int i)`
    `void` | `remove(int from, int to)` Basically a shortcut to sublist(from, to).clear() As this is a common operation, ObservableList has this method for convenient usage.
    `boolean` | `remove(Object obj)`
    `boolean` | `removeAll(Collection<?> objects)`
    `boolean` | `removeAll(E... elements)` A convenient method for var-arg usage of removaAll method.
    `boolean` | `retainAll(Collection<?> objects)`
    `boolean` | `retainAll(E... elements)` A convenient method for var-arg usage of retain method.
    `E` | `set(int i, E element)`
    `boolean` | `setAll(Collection<? extends E> elements)` Clears the ObservableList and add all elements from the collection.
    `boolean` | `setAll(E... elements)` Clears the ObservableList and add all the elements passed as var-args.
    `int` | `size()`
    `abstract ReadOnlyIntegerProperty` | `sizeProperty()` An integer property that represents the size of the list.
    `List<E>` | `subList(int from, int to)`
    `Object[]` | `toArray()`
    `<T> T[]` | `toArray(T[] array)`
    `ObjectBinding<E>` | `valueAt(int index)` Creates a new `ObjectBinding` that contains the element at the specified position.
    `ObjectBinding<E>` | `valueAt(ObservableIntegerValue index)` Creates a new `ObjectBinding` that contains the element at the specified position.

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

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

    - ### Methods inherited from interface javafx.beans.value.ObservableObjectValue

      `get`

    - ### Methods inherited from interface javafx.beans.value.ObservableValue

      `addListener, removeListener`

    - ### Methods inherited from interface javafx.beans.Observable

      `addListener, removeListener`

    - ### Methods inherited from interface javafx.collections.ObservableList

      `addListener, filtered, removeListener, sorted, sorted`

    - ### Methods inherited from interface java.util.List

      `equals, hashCode, replaceAll, sort, spliterator`

    - ### Methods inherited from interface java.util.Collection

      `parallelStream, removeIf, stream`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach`

- - ### Property Detail

    - #### size

          public abstract ReadOnlyIntegerProperty sizeProperty

      An integer property that represents the size of the list.
      See Also:
        `getSize()`

    - #### empty

          public abstract ReadOnlyBooleanProperty emptyProperty

      A boolean property that is `true`, if the list is empty.
      See Also:
        `isEmpty()`

  - ### Constructor Detail

    - #### ListExpression

          public ListExpression()

  - ### Method Detail

    - #### getValue

          public ObservableList<E> getValue()

      Description copied from interface: `ObservableValue`
      Returns the current value of this `ObservableValue`
      Specified by:
        `getValue` in interface `ObservableValue<ObservableList<E>>`
      Returns:
        The current value

    - #### listExpression

          public static <E> ListExpression<E> listExpression(ObservableListValue<E> value)

      Returns a `ListExpression` that wraps a `ObservableListValue`. If the `ObservableListValue` is already a `ListExpression`, it will be returned. Otherwise a new `ListBinding` is created that is bound to the `ObservableListValue`.
      Parameters:
        `value` - The source `ObservableListValue`
      Returns:
        A `ListExpression` that wraps the `ObservableListValue` if necessary
      Throws:
        `NullPointerException` - if `value` is `null`

    - #### getSize

          public int getSize()

      The size of the list

    - #### sizeProperty

          public abstract ReadOnlyIntegerProperty sizeProperty()

      An integer property that represents the size of the list.
      See Also:
        `getSize()`

    - #### emptyProperty

          public abstract ReadOnlyBooleanProperty emptyProperty()

      A boolean property that is `true`, if the list is empty.
      See Also:
        `isEmpty()`

    - #### valueAt

          public ObjectBinding<E> valueAt(int index)

      Creates a new `ObjectBinding` that contains the element at the specified position. If `index` points behind the list, the `ObjectBinding` contains `null`.
      Parameters:
        `index` - the index of the element
      Returns:
        the `ObjectBinding`
      Throws:
        `IllegalArgumentException` - if `index < 0`

    - #### valueAt

          public ObjectBinding<E> valueAt(ObservableIntegerValue index)

      Creates a new `ObjectBinding` that contains the element at the specified position. If `index` points outside of the list, the `ObjectBinding` contains `null`.
      Parameters:
        `index` - the index of the element
      Returns:
        the `ObjectBinding`
      Throws:
        `NullPointerException` - if `index` is `null`

    - #### isEqualTo

          public BooleanBinding isEqualTo(ObservableList<?> other)

      Creates a new `BooleanBinding` that holds `true` if this list is equal to another `ObservableList`.
      Parameters:
        `other` - the other `ObservableList`
      Returns:
        the new `BooleanBinding`
      Throws:
        `NullPointerException` - if `other` is `null`

    - #### isNotEqualTo

          public BooleanBinding isNotEqualTo(ObservableList<?> other)

      Creates a new `BooleanBinding` that holds `true` if this list is not equal to another `ObservableList`.
      Parameters:
        `other` - the other `ObservableList`
      Returns:
        the new `BooleanBinding`
      Throws:
        `NullPointerException` - if `other` is `null`

    - #### isNull

          public BooleanBinding isNull()

      Creates a new `BooleanBinding` that holds `true` if the wrapped list is `null`.
      Returns:
        the new `BooleanBinding`

    - #### isNotNull

          public BooleanBinding isNotNull()

      Creates a new `BooleanBinding` that holds `true` if the wrapped list is not `null`.
      Returns:
        the new `BooleanBinding`

    - #### asString

          public StringBinding asString()

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

    - #### size

          public int size()

      Specified by:
        `size` in interface `Collection<E>`
      Specified by:
        `size` in interface `List<E>`

    - #### isEmpty

          public boolean isEmpty()

      Gets the value of the property empty.
      Specified by:
        `isEmpty` in interface `Collection<E>`
      Specified by:
        `isEmpty` in interface `List<E>`
      Property description:
        A boolean property that is `true`, if the list is empty.

    - #### contains

          public boolean contains(Object obj)

      Specified by:
        `contains` in interface `Collection<E>`
      Specified by:
        `contains` in interface `List<E>`

    - #### iterator

          public Iterator<E> iterator()

      Specified by:
        `iterator` in interface `Iterable<E>`
      Specified by:
        `iterator` in interface `Collection<E>`
      Specified by:
        `iterator` in interface `List<E>`

    - #### toArray

          public Object[] toArray()

      Specified by:
        `toArray` in interface `Collection<E>`
      Specified by:
        `toArray` in interface `List<E>`

    - #### toArray

          public <T> T[] toArray(T[] array)

      Specified by:
        `toArray` in interface `Collection<E>`
      Specified by:
        `toArray` in interface `List<E>`

    - #### add

          public boolean add(E element)

      Specified by:
        `add` in interface `Collection<E>`
      Specified by:
        `add` in interface `List<E>`

    - #### remove

          public boolean remove(Object obj)

      Specified by:
        `remove` in interface `Collection<E>`
      Specified by:
        `remove` in interface `List<E>`

    - #### containsAll

          public boolean containsAll(Collection<?> objects)

      Specified by:
        `containsAll` in interface `Collection<E>`
      Specified by:
        `containsAll` in interface `List<E>`

    - #### addAll

          public boolean addAll(Collection<? extends E> elements)

      Specified by:
        `addAll` in interface `Collection<E>`
      Specified by:
        `addAll` in interface `List<E>`

    - #### addAll

          public boolean addAll(int i,
                                Collection<? extends E> elements)

      Specified by:
        `addAll` in interface `List<E>`

    - #### removeAll

          public boolean removeAll(Collection<?> objects)

      Specified by:
        `removeAll` in interface `Collection<E>`
      Specified by:
        `removeAll` in interface `List<E>`

    - #### retainAll

          public boolean retainAll(Collection<?> objects)

      Specified by:
        `retainAll` in interface `Collection<E>`
      Specified by:
        `retainAll` in interface `List<E>`

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `Collection<E>`
      Specified by:
        `clear` in interface `List<E>`

    - #### get

          public E get(int i)

      Specified by:
        `get` in interface `List<E>`

    - #### set

          public E set(int i,
                       E element)

      Specified by:
        `set` in interface `List<E>`

    - #### add

          public void add(int i,
                          E element)

      Specified by:
        `add` in interface `List<E>`

    - #### remove

          public E remove(int i)

      Specified by:
        `remove` in interface `List<E>`

    - #### indexOf

          public int indexOf(Object obj)

      Specified by:
        `indexOf` in interface `List<E>`

    - #### lastIndexOf

          public int lastIndexOf(Object obj)

      Specified by:
        `lastIndexOf` in interface `List<E>`

    - #### listIterator

          public ListIterator<E> listIterator()

      Specified by:
        `listIterator` in interface `List<E>`

    - #### listIterator

          public ListIterator<E> listIterator(int i)

      Specified by:
        `listIterator` in interface `List<E>`

    - #### subList

          public List<E> subList(int from,
                                 int to)

      Specified by:
        `subList` in interface `List<E>`

    - #### addAll

          public boolean addAll(E... elements)

      Description copied from interface: `ObservableList`
      A convenient method for var-arg adding of elements.
      Specified by:
        `addAll` in interface `ObservableList<E>`
      Parameters:
        `elements` - the elements to add
      Returns:
        true (as specified by Collection.add(E))

    - #### setAll

          public boolean setAll(E... elements)

      Description copied from interface: `ObservableList`
      Clears the ObservableList and add all the elements passed as var-args.
      Specified by:
        `setAll` in interface `ObservableList<E>`
      Parameters:
        `elements` - the elements to set
      Returns:
        true (as specified by Collection.add(E))

    - #### setAll

          public boolean setAll(Collection<? extends E> elements)

      Description copied from interface: `ObservableList`
      Clears the ObservableList and add all elements from the collection.
      Specified by:
        `setAll` in interface `ObservableList<E>`
      Parameters:
        `elements` - the collection with elements that will be added to this observableArrayList
      Returns:
        true (as specified by Collection.add(E))

    - #### removeAll

          public boolean removeAll(E... elements)

      Description copied from interface: `ObservableList`
      A convenient method for var-arg usage of removaAll method.
      Specified by:
        `removeAll` in interface `ObservableList<E>`
      Parameters:
        `elements` - the elements to be removed
      Returns:
        true if list changed as a result of this call

    - #### retainAll

          public boolean retainAll(E... elements)

      Description copied from interface: `ObservableList`
      A convenient method for var-arg usage of retain method.
      Specified by:
        `retainAll` in interface `ObservableList<E>`
      Parameters:
        `elements` - the elements to be retained
      Returns:
        true if list changed as a result of this call

    - #### remove

          public void remove(int from,
                             int to)

      Description copied from interface: `ObservableList`
      Basically a shortcut to sublist(from, to).clear() As this is a common operation, ObservableList has this method for convenient usage.
      Specified by:
        `remove` in interface `ObservableList<E>`
      Parameters:
        `from` - the start of the range to remove (inclusive)
        `to` - the end of the range to remove (exclusive)

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2019, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.