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
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
PropertiesTypePropertyDescriptionabstract ReadOnlyBooleanPropertyA boolean property that istrue, if the set is empty.abstract ReadOnlyIntegerPropertyAn integer property that represents the size of the set. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends E> elements) asString()voidclear()booleanbooleancontainsAll(Collection<?> objects) abstract ReadOnlyBooleanPropertyA boolean property that istrue, if the set is empty.intgetSize()The size of the setgetValue()Returns the current value of thisObservableValuebooleanisEmpty()Gets the value of theemptyproperty.isEqualTo(ObservableSet<?> other) isNotEqualTo(ObservableSet<?> other) isNull()iterator()booleanbooleanremoveAll(Collection<?> objects) booleanretainAll(Collection<?> objects) static <E> SetExpression<E> setExpression(ObservableSetValue<E> value) Returns aSetExpressionthat wraps aObservableSetValue.intsize()abstract ReadOnlyIntegerPropertyAn integer property that represents the size of the set.Object[]toArray()<T> T[]toArray(T[] array) Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods declared in interface Collection
parallelStream, removeIf, stream, toArrayMethods declared in interface Observable
addListener, removeListener, subscribeModifier and TypeMethodDescriptionvoidaddListener(InvalidationListener listener) Adds anInvalidationListenerwhich will be notified whenever theObservablebecomes invalid.voidremoveListener(InvalidationListener listener) Removes the given listener from the list of listeners, that are notified whenever the value of theObservablebecomes invalid.default SubscriptionCreates aSubscriptionon thisObservablewhich callsinvalidationSubscriberwhenever it becomes invalid.Methods declared in interface ObservableObjectValue
getModifier and TypeMethodDescriptionget()Returns the current value of thisObservableObjectValue<T>.Methods declared in interface ObservableSet
addListener, removeListenerModifier and TypeMethodDescriptionvoidaddListener(SetChangeListener<? super E> listener) Add a listener to this observable set.voidremoveListener(SetChangeListener<? super E> listener) Tries to removed a listener from this observable set.Methods declared in interface ObservableValue
addListener, flatMap, map, orElse, removeListener, subscribe, subscribe, whenModifier and TypeMethodDescriptionvoidaddListener(ChangeListener<? super ObservableSet<E>> listener) Adds aChangeListenerwhich will be notified whenever the value of theObservableValuechanges.default <U> ObservableValue<U> flatMap(Function<? super ObservableSet<E>, ? extends ObservableValue<? extends U>> mapper) Returns anObservableValuethat holds the value of anObservableValueproduced by applying the given mapping function on this value.default <U> ObservableValue<U> map(Function<? super ObservableSet<E>, ? extends U> mapper) Returns anObservableValuethat holds the result of applying the given mapping function on this value.default ObservableValue<ObservableSet<E>> orElse(ObservableSet<E> constant) Returns anObservableValuethat holds this value, or the given constant if it isnull.voidremoveListener(ChangeListener<? super ObservableSet<E>> listener) Removes the given listener from the list of listeners that are notified whenever the value of theObservableValuechanges.default Subscriptionsubscribe(BiConsumer<? super ObservableSet<E>, ? super ObservableSet<E>> changeSubscriber) Creates aSubscriptionon thisObservableValuewhich calls the givenchangeSubscriberwith the old and new value whenever its value changes.default Subscriptionsubscribe(Consumer<? super ObservableSet<E>> valueSubscriber) Creates aSubscriptionon thisObservableValuewhich immediately provides the current value to the givenvalueSubscriber, followed by any subsequent values whenever its value changes.default ObservableValue<ObservableSet<E>> when(ObservableValue<Boolean> condition) Returns anObservableValuethat holds this value and is updated only whenconditionholdstrue.Methods declared in interface Set
equals, hashCode, spliterator
-
Property Details
-
size
An integer property that represents the size of the set.- See Also:
-
empty
A boolean property that istrue, if the set is empty.- See Also:
-
-
Constructor Details
-
SetExpression
public SetExpression()Creates a defaultSetExpression.
-
-
Method Details
-
getValue
Description copied from interface:ObservableValueReturns the current value of thisObservableValue- Specified by:
getValuein interfaceObservableValue<E>- Returns:
- The current value
-
setExpression
Returns aSetExpressionthat wraps aObservableSetValue. If theObservableSetValueis already aSetExpression, it will be returned. Otherwise a newSetBindingis created that is bound to theObservableSetValue.- 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
An integer property that represents the size of the set.- Returns:
- the property
- See Also:
-
emptyProperty
A boolean property that istrue, if the set is empty.- Returns:
- the
ReadOnlyBooleanProperty - See Also:
-
isEqualTo
- Parameters:
other- the otherObservableSet- Returns:
- the new
BooleanBinding - Throws:
NullPointerException- ifotherisnull
-
isNotEqualTo
- Parameters:
other- the otherObservableSet- Returns:
- the new
BooleanBinding - Throws:
NullPointerException- ifotherisnull
-
isNull
- Returns:
- the new
BooleanBinding
-
isNotNull
- Returns:
- the new
BooleanBinding
-
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
-
isEmpty
-
contains
-
iterator
-
toArray
-
toArray
-
add
-
remove
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceSet<E>
-
addAll
-
removeAll
-
retainAll
-
clear
-