Class ListExpression<E>
- 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:
public abstract class ListExpression<E> extends Object implements ObservableListValue<E>
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 MethodsInstance MethodsAbstract Methods Type Property and Description abstract ReadOnlyBooleanPropertyemptyA boolean property that istrue, if the list is empty.abstract ReadOnlyIntegerPropertysizeAn integer property that represents the size of the list.
-
Constructor Summary
Constructors Constructor and Description ListExpression()
-
Method Summary
All MethodsStatic MethodsInstance MethodsAbstract MethodsConcrete Methods Modifier and Type Method and Description booleanadd(E element)voidadd(int i, E element)booleanaddAll(Collection<? extends E> elements)booleanaddAll(E... elements)A convenient method for var-arg adding of elements.booleanaddAll(int i, Collection<? extends E> elements)StringBindingasString()voidclear()booleancontains(Object obj)booleancontainsAll(Collection<?> objects)abstract ReadOnlyBooleanPropertyemptyProperty()A boolean property that istrue, if the list is empty.Eget(int i)intgetSize()The size of the listObservableList<E>getValue()Returns the current value of thisObservableValueintindexOf(Object obj)booleanisEmpty()Gets the value of the property empty.BooleanBindingisEqualTo(ObservableList<?> other)BooleanBindingisNotEqualTo(ObservableList<?> other)BooleanBindingisNotNull()BooleanBindingisNull()Iterator<E>iterator()intlastIndexOf(Object obj)static <E> ListExpression<E>listExpression(ObservableListValue<E> value)Returns aListExpressionthat wraps aObservableListValue.ListIterator<E>listIterator()ListIterator<E>listIterator(int i)Eremove(int i)voidremove(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.booleanremove(Object obj)booleanremoveAll(Collection<?> objects)booleanremoveAll(E... elements)A convenient method for var-arg usage of removaAll method.booleanretainAll(Collection<?> objects)booleanretainAll(E... elements)A convenient method for var-arg usage of retain method.Eset(int i, E element)booleansetAll(Collection<? extends E> elements)Clears the ObservableList and add all elements from the collection.booleansetAll(E... elements)Clears the ObservableList and add all the elements passed as var-args.intsize()abstract ReadOnlyIntegerPropertysizeProperty()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 newObjectBindingthat contains the element at the specified position.ObjectBinding<E>valueAt(ObservableIntegerValue index)Creates a newObjectBindingthat 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
-
-
Property Detail
-
size
public abstract ReadOnlyIntegerProperty sizeProperty
An integer property that represents the size of the list.See Also:
-
empty
public abstract ReadOnlyBooleanProperty emptyProperty
A boolean property that istrue, if the list is empty.See Also:
-
-
Constructor Detail
-
ListExpression
public ListExpression()
-
-
Method Detail
-
getValue
public ObservableList<E> getValue()
Description copied from interface:ObservableValueReturns the current value of thisObservableValueSpecified by:
getValuein interfaceObservableValue<ObservableList<E>>Returns:
The current value
-
listExpression
public static <E> ListExpression<E> listExpression(ObservableListValue<E> value)
Returns aListExpressionthat wraps aObservableListValue. If theObservableListValueis already aListExpression, it will be returned. Otherwise a newListBindingis created that is bound to theObservableListValue.Parameters:
value- The sourceObservableListValueReturns:
A
ListExpressionthat wraps theObservableListValueif necessaryThrows:
NullPointerException- ifvalueisnull
-
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:
-
emptyProperty
public abstract ReadOnlyBooleanProperty emptyProperty()
A boolean property that istrue, if the list is empty.See Also:
-
valueAt
public ObjectBinding<E> valueAt(int index)
Creates a newObjectBindingthat contains the element at the specified position. Ifindexpoints behind the list, theObjectBindingcontainsnull.Parameters:
index- the index of the elementReturns:
the
ObjectBindingThrows:
IllegalArgumentException- ifindex < 0
-
valueAt
public ObjectBinding<E> valueAt(ObservableIntegerValue index)
Creates a newObjectBindingthat contains the element at the specified position. Ifindexpoints outside of the list, theObjectBindingcontainsnull.Parameters:
index- the index of the elementReturns:
the
ObjectBindingThrows:
NullPointerException- ifindexisnull
-
isEqualTo
public BooleanBinding isEqualTo(ObservableList<?> other)
Parameters:
other- the otherObservableListReturns:
the new
BooleanBindingThrows:
NullPointerException- ifotherisnull
-
isNotEqualTo
public BooleanBinding isNotEqualTo(ObservableList<?> other)
Parameters:
other- the otherObservableListReturns:
the new
BooleanBindingThrows:
NullPointerException- ifotherisnull
-
isNull
public BooleanBinding isNull()
Returns:
the new
BooleanBinding
-
isNotNull
public BooleanBinding isNotNull()
Returns:
the new
BooleanBinding
-
asString
public StringBinding asString()
Creates aStringBindingthat holds the value of theListExpressionturned into aString. If the value of thisListExpressionchanges, the value of theStringBindingwill be updated automatically.Returns:
the new
StringBinding
-
size
public int size()
-
isEmpty
public boolean isEmpty()
Gets the value of the property empty.
-
contains
public boolean contains(Object obj)
-
iterator
public Iterator<E> iterator()
-
toArray
public Object[] toArray()
-
toArray
public <T> T[] toArray(T[] array)
-
add
public boolean add(E element)
-
remove
public boolean remove(Object obj)
-
containsAll
public boolean containsAll(Collection<?> objects)
Specified by:
containsAllin interfaceCollection<E>Specified by:
containsAllin interfaceList<E>
-
addAll
public boolean addAll(Collection<? extends E> elements)
-
addAll
public boolean addAll(int i, Collection<? extends E> elements)
-
removeAll
public boolean removeAll(Collection<?> objects)
-
retainAll
public boolean retainAll(Collection<?> objects)
-
clear
public void clear()
-
get
public E get(int i)
-
set
public E set(int i, E element)
-
add
public void add(int i, E element)
-
remove
public E remove(int i)
-
indexOf
public int indexOf(Object obj)
-
lastIndexOf
public int lastIndexOf(Object obj)
Specified by:
lastIndexOfin interfaceList<E>
-
listIterator
public ListIterator<E> listIterator()
Specified by:
listIteratorin interfaceList<E>
-
listIterator
public ListIterator<E> listIterator(int i)
Specified by:
listIteratorin interfaceList<E>
-
subList
public List<E> subList(int from, int to)
-
addAll
public boolean addAll(E... elements)
Description copied from interface:ObservableListA convenient method for var-arg adding of elements.Specified by:
addAllin interfaceObservableList<E>Parameters:
elements- the elements to addReturns:
true (as specified by Collection.add(E))
-
setAll
public boolean setAll(E... elements)
Description copied from interface:ObservableListClears the ObservableList and add all the elements passed as var-args.Specified by:
setAllin interfaceObservableList<E>Parameters:
elements- the elements to setReturns:
true (as specified by Collection.add(E))
-
setAll
public boolean setAll(Collection<? extends E> elements)
Description copied from interface:ObservableListClears the ObservableList and add all elements from the collection.Specified by:
setAllin interfaceObservableList<E>Parameters:
elements- the collection with elements that will be added to this observableArrayListReturns:
true (as specified by Collection.add(E))
-
removeAll
public boolean removeAll(E... elements)
Description copied from interface:ObservableListA convenient method for var-arg usage of removaAll method.Specified by:
removeAllin interfaceObservableList<E>Parameters:
elements- the elements to be removedReturns:
true if list changed as a result of this call
-
retainAll
public boolean retainAll(E... elements)
Description copied from interface:ObservableListA convenient method for var-arg usage of retain method.Specified by:
retainAllin interfaceObservableList<E>Parameters:
elements- the elements to be retainedReturns:
true if list changed as a result of this call
-
remove
public void remove(int from, int to)Description copied from interface:ObservableListBasically a shortcut to sublist(from, to).clear() As this is a common operation, ObservableList has this method for convenient usage.Specified by:
removein interfaceObservableList<E>Parameters:
from- the start of the range to remove (inclusive)
-
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.