Class SetExpression<E>
- 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:
public abstract class SetExpression<E> extends Object implements ObservableSetValue<E>
SetExpression is a 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
All MethodsInstance MethodsAbstract Methods Type Property and Description abstract ReadOnlyBooleanPropertyemptyA boolean property that istrue, if the set is empty.abstract ReadOnlyIntegerPropertysizeAn integer property that represents the size of the set.
-
Constructor Summary
Constructors Constructor and Description SetExpression()
-
Method Summary
All MethodsStatic MethodsInstance MethodsAbstract MethodsConcrete Methods Modifier and Type Method and Description booleanadd(E element)booleanaddAll(Collection<? extends E> elements)StringBindingasString()voidclear()booleancontains(Object obj)booleancontainsAll(Collection<?> objects)abstract ReadOnlyBooleanPropertyemptyProperty()A boolean property that istrue, if the set is empty.intgetSize()The size of the setObservableSet<E>getValue()Returns the current value of thisObservableValuebooleanisEmpty()Gets the value of the property empty.BooleanBindingisEqualTo(ObservableSet<?> other)BooleanBindingisNotEqualTo(ObservableSet<?> other)BooleanBindingisNotNull()BooleanBindingisNull()Iterator<E>iterator()booleanremove(Object obj)booleanremoveAll(Collection<?> objects)booleanretainAll(Collection<?> objects)static <E> SetExpression<E>setExpression(ObservableSetValue<E> value)Returns aSetExpressionthat wraps aObservableSetValue.intsize()abstract ReadOnlyIntegerPropertysizeProperty()An integer property that represents the size of the set.Object[]toArray()<T> T[]toArray(T[] array)-
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.ObservableSet
addListener, removeListener
-
Methods inherited from interface java.util.Set
equals, hashCode, 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 set.See Also:
-
empty
public abstract ReadOnlyBooleanProperty emptyProperty
A boolean property that istrue, if the set is empty.See Also:
-
-
Constructor Detail
-
SetExpression
public SetExpression()
-
-
Method Detail
-
getValue
public ObservableSet<E> getValue()
Description copied from interface:ObservableValueReturns the current value of thisObservableValueSpecified by:
getValuein interfaceObservableValue<ObservableSet<E>>Returns:
The current value
-
setExpression
public static <E> SetExpression<E> setExpression(ObservableSetValue<E> value)
Returns aSetExpressionthat wraps aObservableSetValue. If theObservableSetValueis already aSetExpression, it will be returned. Otherwise a newSetBindingis created that is bound to theObservableSetValue.Parameters:
value- The sourceObservableSetValueReturns:
A
SetExpressionthat wraps theObservableSetValueif necessaryThrows:
NullPointerException- ifvalueisnull
-
getSize
public int getSize()
The size of the set
-
sizeProperty
public abstract ReadOnlyIntegerProperty sizeProperty()
An integer property that represents the size of the set.See Also:
-
emptyProperty
public abstract ReadOnlyBooleanProperty emptyProperty()
A boolean property that istrue, if the set is empty.See Also:
-
isEqualTo
public BooleanBinding isEqualTo(ObservableSet<?> other)
Parameters:
other- the otherObservableSetReturns:
the new
BooleanBindingThrows:
NullPointerException- ifotherisnull
-
isNotEqualTo
public BooleanBinding isNotEqualTo(ObservableSet<?> other)
Parameters:
other- the otherObservableSetReturns:
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 theSetExpressionturned into aString. If the value of thisSetExpressionchanges, 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 interfaceSet<E>
-
addAll
public boolean addAll(Collection<? extends E> elements)
-
removeAll
public boolean removeAll(Collection<?> objects)
-
retainAll
public boolean retainAll(Collection<?> objects)
-
clear
public void clear()
-
© 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.