Class SetExpression<E>
java.lang.Object
javafx.beans.binding.SetExpression<E>
- Type Parameters:
-
E- the type of theSetelements
- 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
| 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
| Constructor | Description |
|---|---|
SetExpression() |
Creates a default SetExpression. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
add |
|
boolean |
addAll |
|
StringBinding |
asString() |
|
void |
clear() |
|
boolean |
contains |
|
boolean |
containsAll |
|
abstract ReadOnlyBooleanProperty |
emptyProperty() |
A boolean property that is true, if the set is empty. |
int |
getSize() |
The size of the set |
ObservableSet<E> |
getValue() |
Returns the current value of this ObservableValue
|
boolean |
isEmpty() |
Gets the value of the empty property. |
BooleanBinding |
isEqualTo |
|
BooleanBinding |
isNotEqualTo |
|
BooleanBinding |
isNotNull() |
|
BooleanBinding |
isNull() |
|
Iterator<E> |
iterator() |
|
boolean |
remove |
|
boolean |
removeAll |
|
boolean |
retainAll |
|
static <E> SetExpression<E> |
setExpression |
Returns a SetExpression that wraps a ObservableSetValue. |
int |
size() |
|
abstract ReadOnlyIntegerProperty |
sizeProperty() |
An integer property that represents the size of the set. |
Object[] |
toArray() |
|
<T> T[] |
toArray |
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 javafx.beans.Observable
addListener, removeListener, subscribe
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, flatMap, map, orElse, removeListener, subscribe, subscribe, when
Methods declared in interface java.util.Set
equals, hashCode, spliterator
Property Details
size
public abstract ReadOnlyIntegerProperty sizeProperty
An integer property that represents the size of the set.
- See Also:
empty
public abstract ReadOnlyBooleanProperty emptyProperty
A boolean property that is
true, if the set is empty.- See Also:
Constructor Details
SetExpression
public SetExpression()
Creates a default
SetExpression.Method Details
getValue
public ObservableSet<E> getValue()
Description copied from interface:
ObservableValueReturns the current value of this
ObservableValue
- Specified by:
-
getValuein interfaceObservableValue<E> - Returns:
- The current value
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 theSetelements - Parameters:
-
value- The sourceObservableSetValue - Returns:
- A
SetExpressionthat wraps theObservableSetValueif necessary - Throws:
-
NullPointerException- ifvalueisnull
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.
- Returns:
- the property
- See Also:
emptyProperty
public abstract ReadOnlyBooleanProperty emptyProperty()
A boolean property that is
true, if the set is empty.- Returns:
- the
ReadOnlyBooleanProperty - See Also:
isEqualTo
public BooleanBinding isEqualTo(ObservableSet<?> other)
- Parameters:
-
other- the otherObservableSet - Returns:
- the new
BooleanBinding - Throws:
-
NullPointerException- ifotherisnull
isNotEqualTo
public BooleanBinding isNotEqualTo(ObservableSet<?> other)
- Parameters:
-
other- the otherObservableSet - Returns:
- the new
BooleanBinding - Throws:
-
NullPointerException- ifotherisnull
isNull
public BooleanBinding isNull()
- Returns:
- the new
BooleanBinding
isNotNull
public BooleanBinding isNotNull()
- 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
size
public int size()
- Specified by:
-
sizein interfaceCollection<E> - Specified by:
-
sizein interfaceSet<E>
isEmpty
public boolean isEmpty()
Gets the value of the
empty property.- Specified by:
-
isEmptyin interfaceCollection<E> - Specified by:
-
isEmptyin interfaceSet<E> - Property description:
- A boolean property that is
true, if the set is empty. - Returns:
- the value of the
emptyproperty - See Also:
contains
public boolean contains(Object obj)
- Specified by:
-
containsin interfaceCollection<E> - Specified by:
-
containsin interfaceSet<E>
iterator
public Iterator<E> iterator()
- Specified by:
-
iteratorin interfaceCollection<E> - Specified by:
-
iteratorin interfaceIterable<E> - Specified by:
-
iteratorin interfaceSet<E>
toArray
public Object[] toArray()
- Specified by:
-
toArrayin interfaceCollection<E> - Specified by:
-
toArrayin interfaceSet<E>
toArray
public <T> T[] toArray(T[] array)
- Specified by:
-
toArrayin interfaceCollection<E> - Specified by:
-
toArrayin interfaceSet<E>
add
public boolean add(E element)
- Specified by:
-
addin interfaceCollection<E> - Specified by:
-
addin interfaceSet<E>
remove
public boolean remove(Object obj)
- Specified by:
-
removein interfaceCollection<E> - Specified by:
-
removein interfaceSet<E>
containsAll
public boolean containsAll(Collection<?> objects)
- Specified by:
-
containsAllin interfaceCollection<E> - Specified by:
-
containsAllin interfaceSet<E>
addAll
public boolean addAll(Collection<? extends E> elements)
- Specified by:
-
addAllin interfaceCollection<E> - Specified by:
-
addAllin interfaceSet<E>
removeAll
public boolean removeAll(Collection<?> objects)
- Specified by:
-
removeAllin interfaceCollection<E> - Specified by:
-
removeAllin interfaceSet<E>
retainAll
public boolean retainAll(Collection<?> objects)
- Specified by:
-
retainAllin interfaceCollection<E> - Specified by:
-
retainAllin interfaceSet<E>
clear
public void clear()
- Specified by:
-
clearin interfaceCollection<E> - Specified by:
-
clearin interfaceSet<E>
© 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.