E
- the type of the List
elements.public abstract class ListExpression<E> extends java.lang.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.
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 and Description |
---|
ListExpression() |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E element) |
void |
add(int i,
E element) |
boolean |
addAll(java.util.Collection<? extends E> elements) |
boolean |
addAll(E... elements)
A convenient method for var-arg adding of elements.
|
boolean |
addAll(int i,
java.util.Collection<? extends E> elements) |
StringBinding |
asString()
|
void |
clear() |
boolean |
contains(java.lang.Object obj) |
boolean |
containsAll(java.util.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(java.lang.Object obj) |
boolean |
isEmpty()
Gets the value of the property empty.
|
BooleanBinding |
isEqualTo(ObservableList<?> other)
|
BooleanBinding |
isNotEqualTo(ObservableList<?> other)
|
BooleanBinding |
isNotNull()
|
BooleanBinding |
isNull()
|
java.util.Iterator<E> |
iterator() |
int |
lastIndexOf(java.lang.Object obj) |
static <E> ListExpression<E> |
listExpression(ObservableListValue<E> value)
Returns a
ListExpression that wraps a
ObservableListValue . |
java.util.ListIterator<E> |
listIterator() |
java.util.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(java.lang.Object obj) |
boolean |
removeAll(java.util.Collection<?> objects) |
boolean |
removeAll(E... elements)
A convenient method for var-arg usage of removaAll method.
|
boolean |
retainAll(java.util.Collection<?> objects) |
boolean |
retainAll(E... elements)
A convenient method for var-arg usage of retain method.
|
E |
set(int i,
E element) |
boolean |
setAll(java.util.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.
|
java.util.List<E> |
subList(int from,
int to) |
java.lang.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. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get
addListener, removeListener
addListener, removeListener
addListener, filtered, removeListener, sorted, sorted
public abstract ReadOnlyIntegerProperty sizeProperty
getSize()
public abstract ReadOnlyBooleanProperty emptyProperty
true
, if the list is empty.isEmpty()
public ObservableList<E> getValue()
ObservableValue
ObservableValue
getValue
in interface ObservableValue<ObservableList<E>>
public static <E> ListExpression<E> listExpression(ObservableListValue<E> value)
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
.value
- The source ObservableListValue
ListExpression
that wraps the
ObservableListValue
if necessaryjava.lang.NullPointerException
- if value
is null
public int getSize()
public abstract ReadOnlyIntegerProperty sizeProperty()
getSize()
public abstract ReadOnlyBooleanProperty emptyProperty()
true
, if the list is empty.isEmpty()
public ObjectBinding<E> valueAt(int index)
ObjectBinding
that contains the element at the specified position.
If index
points behind the list, the ObjectBinding
contains null
.index
- the index of the elementObjectBinding
java.lang.IllegalArgumentException
- if index < 0
public ObjectBinding<E> valueAt(ObservableIntegerValue index)
ObjectBinding
that contains the element at the specified position.
If index
points outside of the list, the ObjectBinding
contains null
.index
- the index of the elementObjectBinding
java.lang.NullPointerException
- if index
is null
public BooleanBinding isEqualTo(ObservableList<?> other)
other
- the other ObservableList
BooleanBinding
java.lang.NullPointerException
- if other
is null
public BooleanBinding isNotEqualTo(ObservableList<?> other)
other
- the other ObservableList
BooleanBinding
java.lang.NullPointerException
- if other
is null
public BooleanBinding isNull()
BooleanBinding
public BooleanBinding isNotNull()
BooleanBinding
public StringBinding asString()
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.StringBinding
public int size()
public boolean isEmpty()
public boolean contains(java.lang.Object obj)
public java.util.Iterator<E> iterator()
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] array)
public boolean add(E element)
public boolean remove(java.lang.Object obj)
public boolean containsAll(java.util.Collection<?> objects)
public boolean addAll(java.util.Collection<? extends E> elements)
public boolean addAll(int i, java.util.Collection<? extends E> elements)
addAll
in interface java.util.List<E>
public boolean removeAll(java.util.Collection<?> objects)
public boolean retainAll(java.util.Collection<?> objects)
public void clear()
public int indexOf(java.lang.Object obj)
indexOf
in interface java.util.List<E>
public int lastIndexOf(java.lang.Object obj)
lastIndexOf
in interface java.util.List<E>
public java.util.ListIterator<E> listIterator()
listIterator
in interface java.util.List<E>
public java.util.ListIterator<E> listIterator(int i)
listIterator
in interface java.util.List<E>
public java.util.List<E> subList(int from, int to)
subList
in interface java.util.List<E>
public boolean addAll(E... elements)
ObservableList
addAll
in interface ObservableList<E>
elements
- the elements to addpublic boolean setAll(E... elements)
ObservableList
setAll
in interface ObservableList<E>
elements
- the elements to setpublic boolean setAll(java.util.Collection<? extends E> elements)
ObservableList
setAll
in interface ObservableList<E>
elements
- the collection with elements that will be added to this observableArrayListpublic boolean removeAll(E... elements)
ObservableList
removeAll
in interface ObservableList<E>
elements
- the elements to be removedpublic boolean retainAll(E... elements)
ObservableList
retainAll
in interface ObservableList<E>
elements
- the elements to be retainedpublic void remove(int from, int to)
ObservableList
remove
in interface ObservableList<E>
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, 2024, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.