Top Description Methods
org.reactfx.value

public Interface Val<T>

Additional top-level classes in compilation unit: InvalidationListenerWrapper, ChangeListenerWrapper.

extends ObservableValue<T>, Observable<Consumer<? super T>>
Known Direct Subinterfaces
org.reactfx.value.Var, org.reactfx.Toggle, org.reactfx.value.ProperVal, org.reactfx.value.SuspendableVal
Known Direct Implementers
org.reactfx.value.ConstVal, org.reactfx.value.ProxyVal
Imports
java.time.Duration, java.util.NoSuchElementException, .Objects, .Optional, java.util.function.BiFunction, .Consumer, .Function, .Predicate, .Supplier, javafx.animation.Interpolatable, javafx.beans.InvalidationListener, javafx.beans.property.Property, javafx.beans.value.ChangeListener, .ObservableValue, javafx.scene.Node, .Scene, javafx.stage.Window, org.reactfx.Change, .EventStream, .EventStreamBase, .EventStreams, .Observable, .Subscription, org.reactfx.collection.LiveList, org.reactfx.util.HexaFunction, .Interpolator, .PentaFunction, .TetraFunction, .TriFunction, .WrapperBase

Adds more operations to ObservableValue.

Canonical observer of Val<T> is an invalidation observer of type Consumer<? super T>, which accepts the _invalidated_ value. This is different from InvalidationListener, which does not accept the invalidated value.

Method Summary

Modifier and TypeMethod and Description
public default void
addInvalidationObserver(Consumer<? super T> observer)

public default void
addListener(InvalidationListener listener)

Implements javafx.beans.Observable.addListener.

Adds an InvalidationListener which will be notified whenever the Observable becomes invalid.

public default void
addListener(ChangeListener<? super T> listener)

Implements javafx.beans.value.ObservableValue.addListener.

Adds a ChangeListener which will be notified whenever the value of the ObservableValue changes.

public default Val<T>
animate(BiFunction<? super T, ? super T, Duration>
function that calculates the desired duration of the transition for two boundary values.
duration
,
Interpolator<T>
calculates the interpolated value between two boundary values, given a fraction.
interpolator
)

Returns a new Val that gradually transitions to the value of this Val every time this Val changes.

public default Val<T>
animate(Duration
the desired duration of the transition
duration
,
Interpolator<T>
calculates the interpolated value between two boundary values, given a fraction.
interpolator
)

Returns a new Val that gradually transitions to the value of this Val every time this Val changes.

public static <T> Val<T>
animate(ObservableValue<T>
observable value to animate
obs
,
BiFunction<? super T, ? super T, Duration>
function that calculates the desired duration of the transition for two boundary values.
duration
,
Interpolator<T>
calculates the interpolated value between two boundary values, given a fraction.
interpolator
)

Creates a new Val that gradually transitions to the value of the given ObservableValue obs every time obs changes.

public static <T> Val<T>
animate(ObservableValue<T>
observable value to animate
obs
,
Duration
the desired duration of the transition
duration
,
Interpolator<T>
calculates the interpolated value between two boundary values, given a fraction.
interpolator
)

Creates a new Val that gradually transitions to the value of the given ObservableValue obs every time obs changes.

public static <T extends Interpolatable<T>> Val<T>
animate(ObservableValue<T> obs, BiFunction<? super T, ? super T, Duration> duration)

Like animate(ObservableValue, BiFunction, Interpolator), but uses the interpolation defined by the Interpolatable type T.

public static <T extends Interpolatable<T>> Val<T>
animate(ObservableValue<T> obs, Duration duration)

Like animate(ObservableValue, Duration, Interpolator), but uses the interpolation defined by the Interpolatable type T.

public default LiveList<T>
asList()

Returns a LiveList view of this Val.

public default Var<T>
asVar(Consumer<T> setValue)

Let's this Val be viewed as a Var, with the given setValue function serving the purpose of Var#setValue(Object).

public default EventStream<Change<T>>
changes()

Returns a stream of changed values, which emits the changed value (i.e. the old and the new value) on each change of this observable value.

public static <A, B, R> Val<R>
combine(ObservableValue<A> src1, ObservableValue<B> src2, BiFunction<? super A, ? super B, ? extends R> f)

public static <A, B, C, R> Val<R>
combine(ObservableValue<A> src1, ObservableValue<B> src2, ObservableValue<C> src3, TriFunction<? super A, ? super B, ? super C, ? extends R> f)

public static <A, B, C, D, R> Val<R>
combine(ObservableValue<A> src1, ObservableValue<B> src2, ObservableValue<C> src3, ObservableValue<D> src4, TetraFunction<? super A, ? super B, ? super C, ? super D, ? extends R> f)

public static <A, B, C, D, E, R> Val<R>
combine(ObservableValue<A> src1, ObservableValue<B> src2, ObservableValue<C> src3, ObservableValue<D> src4, ObservableValue<E> src5, PentaFunction<? super A, ? super B, ? super C, ? super D, ? super E, ? extends R> f)

public static <A, B, C, D, E, F, R> Val<R>
combine(ObservableValue<A> src1, ObservableValue<B> src2, ObservableValue<C> src3, ObservableValue<D> src4, ObservableValue<E> src5, ObservableValue<F> src6, HexaFunction<? super A, ? super B, ? super C, ? super D, ? super E, ? super F, ? extends R> f)

public default Val<T>
conditionOn(ObservableValue<Boolean> condition)

Returns a new Val that only observes this Val when condition is true.

public static <T> Val<T>
public default Val<T>
conditionOnShowing(Node node)

Equivalent to conditionOn(ObservableValue) where the condition is that node is showing: it is part of a scene graph (Node#sceneProperty() is not null), its scene is part of a window (Scene#windowProperty() is not null) and the window is showing (Window#showingProperty() is true).

public static <T> Val<T>
public static <T> Val<T>
constant(T value)

Returns a constant Val that holds the given value.

public static <T> Val<T>
create(Supplier<? extends T> computeValue, Observable... dependencies)

public static <T> Val<T>
create(Supplier<? extends T> computeValue, EventStream<?> invalidations)

public default Val<T>
filter(Predicate<? super T> p)

Returns a new Val that holds the same value as this Val when the value satisfies the predicate and is empty when this Val is empty or its value does not satisfy the given predicate.

public static <T> Val<T>
filter(ObservableValue<T> src, Predicate<? super T> p)

public default <U> Val<U>
flatMap(Function<? super T, ? extends ObservableValue<U>> f)

Overrides default javafx.beans.value.ObservableValue.flatMap.

Returns a new Val that, when this Val holds value x, holds the value held by f(x), and is empty when this Val is empty.

public static <T, U> Val<U>
flatMap(ObservableValue<T> src, Function<? super T, ? extends ObservableValue<U>> f)

public default Optional<T>
getOpt()

Returns an Optional describing the value currently held by this Val, or and empty Optional if this Val is empty.

public default T
getOrElse(T
value to return if there is no value present in this Val.
defaultValue
)

Returns the value currently held by this Val.

public default T
getOrSupply(Supplier<? extends T>
computation to produce default value, if this Val is empty.
defaultSupplier
)

Like getOrElse(Object), except the default value is computed by defaultSupplier only when necessary.

public default T
getOrThrow()

Returns the value currently held by this Val.

public default void
ifPresent(Consumer<? super T>
function to invoke on the value currently held by this Val.
f
)

Invokes the given function if this Val holds a (non-null) value.

public default EventStream<T>
invalidations()

Returns a stream of invalidated values, which emits the invalidated value (i.e. the old value) on each invalidation of this observable value.

public default boolean
isEmpty()

Inverse of isPresent().

public default boolean

Returns:

true if this Val holds a (non-null) value, false otherwise.
isPresent
()

Checks whether this Val holds a (non-null) value.

public default <U> Val<U>
map(Function<? super T, ? extends U>
function to map the value held by this Val.
f
)

Overrides default javafx.beans.value.ObservableValue.map.

Returns a new Val that holds a mapping of the value held by this Val, and is empty when this Val is empty.

public static <T, U> Val<U>
map(ObservableValue<T> src, Function<? super T, ? extends U> f)

public default <U> Val<U>
mapDynamic(ObservableValue<? extends Function<? super T, ? extends U>> f)

Like map(Function), but also allows dynamically changing map function.

public static <T, U> Val<U>
mapDynamic(ObservableValue<T> src, ObservableValue<? extends Function<? super T, ? extends U>> f)

public default Subscription
observeChanges(ChangeListener<? super T> listener)

Adds a change listener and returns a Subscription that can be used to remove that listener.

public static <T> Subscription
observeChanges(ObservableValue<? extends T> obs, ChangeListener<? super T> listener)

public default Subscription
observeInvalidations(Consumer<? super T> oldValueObserver)

public static Subscription
public default Val<T>
orElse(ObservableValue<T> other)

Overrides default javafx.beans.value.ObservableValue.orElse.

Returns a new Val that holds the value held by this Val, or the value held by other when this Val is empty.

public static <T> Val<T>
orElse(ObservableValue<? extends T> src, ObservableValue<? extends T> other)

public default Val<T>
orElseConst(T other)

Returns a new Val that holds the value held by this Val, or other when this Val is empty.

public static <T> Val<T>
orElseConst(ObservableValue<? extends T> src, T other)

public default Subscription
pin()

public default void
removeInvalidationObserver(Consumer<? super T> observer)

public default void
removeListener(InvalidationListener listener)

Implements javafx.beans.Observable.removeListener.

Removes the given listener from the list of listeners, that are notified whenever the value of the Observable becomes invalid.

public default void
removeListener(ChangeListener<? super T> listener)

Implements javafx.beans.value.ObservableValue.removeListener.

Removes the given listener from the list of listeners that are notified whenever the value of the ObservableValue changes.

public default <U> Var<U>
selectVar(Function<? super T, ? extends Property<U>> f)

Similar to flatMap(Function), except the returned Val is also a Var.

public default <U> Var<U>
selectVar(Function<? super T, ? extends Property<U>> f, U resetToOnUnbind)

public static <T, U> Var<U>
selectVar(ObservableValue<T> src, Function<? super T, ? extends Property<U>> f)

public static <T, U> Var<U>
selectVar(ObservableValue<T> src, Function<? super T, ? extends Property<U>> f, U resetToOnUnbind)

public static Val<Boolean>
showingProperty(Node node)

Returns a Val whose value is true when node is showing: it is part of a scene graph (Node#sceneProperty() is not null), its scene is part of a window (Scene#windowProperty() is not null) and the window is showing (Window#showingProperty() is true).

public default SuspendableVal<T>
public static <T> SuspendableVal<T>
public default EventStream<T>
values()

Returns a stream of values of this Val.

public static <T> Val<T>
wrap(ObservableValue<T> obs)

Returns a Val wrapper around ObservableValue.

Inherited from javafx.beans.value.ObservableValue:
getValuesubscribesubscribewhen
Inherited from org.reactfx.Observable:
addObserverobserveremoveObserver

Method Detail

addInvalidationObserverback to summary
public default void addInvalidationObserver(Consumer<? super T> observer)
addListenerback to summary
public default void addListener(InvalidationListener listener)

Implements javafx.beans.Observable.addListener.

Doc from javafx.beans.Observable.addListener.

Adds an InvalidationListener which will be notified whenever the Observable becomes invalid. If the same listener is added more than once, then it will be notified more than once. That is, no check is made to ensure uniqueness.

Note that the same actual InvalidationListener instance may be safely registered for different Observables.

The Observable stores a strong reference to the listener which will prevent the listener from being garbage collected and may result in a memory leak. It is recommended to either unregister a listener by calling removeListener after use or to use an instance of WeakInvalidationListener avoid this situation.

Annotations
@Override
addListenerback to summary
public default void addListener(ChangeListener<? super T> listener)

Implements javafx.beans.value.ObservableValue.addListener.

Doc from javafx.beans.value.ObservableValue.addListener.

Adds a ChangeListener which will be notified whenever the value of the ObservableValue changes. If the same listener is added more than once, then it will be notified more than once. That is, no check is made to ensure uniqueness.

Note that the same actual ChangeListener instance may be safely registered for different ObservableValues.

The ObservableValue stores a strong reference to the listener which will prevent the listener from being garbage collected and may result in a memory leak. It is recommended to either unregister a listener by calling removeListener after use or to use an instance of WeakChangeListener avoid this situation.

Annotations
@Override
animateback to summary
public default Val<T> animate(BiFunction<? super T, ? super T, Duration> duration, Interpolator<T> interpolator)

Returns a new Val that gradually transitions to the value of this Val every time this Val changes.

When the returned Val has no observer, there is no gradual transition taking place. This means that there is no animation running in the background that would consume system resources. This also means that in that case getValue() always returns the target value (i.e. the current value of this Val), instead of any intermediate interpolated value.

Parameters
duration:BiFunction<? super T, ? super T, Duration>

function that calculates the desired duration of the transition for two boundary values.

interpolator:Interpolator<T>

calculates the interpolated value between two boundary values, given a fraction.

animateback to summary
public default Val<T> animate(Duration duration, Interpolator<T> interpolator)

Returns a new Val that gradually transitions to the value of this Val every time this Val changes.

When the returned Val has no observer, there is no gradual transition taking place. This means that there is no animation running in the background that would consume system resources. This also means that in that case getValue() always returns the target value (i.e. the current value of this Val), instead of any intermediate interpolated value.

Parameters
duration:Duration

the desired duration of the transition

interpolator:Interpolator<T>

calculates the interpolated value between two boundary values, given a fraction.

animateback to summary
public static <T> Val<T> animate(ObservableValue<T> obs, BiFunction<? super T, ? super T, Duration> duration, Interpolator<T> interpolator)

Creates a new Val that gradually transitions to the value of the given ObservableValue obs every time obs changes.

When the returned Val has no observer, there is no gradual transition taking place. This means that there is no animation running in the background that would consume system resources. This also means that in that case getValue() always returns the target value (i.e. the current value of obs), instead of any intermediate interpolated value.

Parameters
obs:ObservableValue<T>

observable value to animate

duration:BiFunction<? super T, ? super T, Duration>

function that calculates the desired duration of the transition for two boundary values.

interpolator:Interpolator<T>

calculates the interpolated value between two boundary values, given a fraction.

animateback to summary
public static <T> Val<T> animate(ObservableValue<T> obs, Duration duration, Interpolator<T> interpolator)

Creates a new Val that gradually transitions to the value of the given ObservableValue obs every time obs changes.

When the returned Val has no observer, there is no gradual transition taking place. This means that there is no animation running in the background that would consume system resources. This also means that in that case getValue() always returns the target value (i.e. the current value of obs), instead of any intermediate interpolated value.

Parameters
obs:ObservableValue<T>

observable value to animate

duration:Duration

the desired duration of the transition

interpolator:Interpolator<T>

calculates the interpolated value between two boundary values, given a fraction.

animateback to summary
public static <T extends Interpolatable<T>> Val<T> animate(ObservableValue<T> obs, BiFunction<? super T, ? super T, Duration> duration)

Like animate(ObservableValue, BiFunction, Interpolator), but uses the interpolation defined by the Interpolatable type T.

animateback to summary
public static <T extends Interpolatable<T>> Val<T> animate(ObservableValue<T> obs, Duration duration)

Like animate(ObservableValue, Duration, Interpolator), but uses the interpolation defined by the Interpolatable type T.

asListback to summary
public default LiveList<T> asList()

Returns a LiveList view of this Val. The returned list will have size 1 when this Val is present (i.e. not null) and size 0 otherwise.

asVarback to summary
public default Var<T> asVar(Consumer<T> setValue)

Let's this Val be viewed as a Var, with the given setValue function serving the purpose of Var#setValue(Object).

See Also
Var#fromVal(ObservableValue, Consumer)
changesback to summary
public default EventStream<Change<T>> changes()

Returns a stream of changed values, which emits the changed value (i.e. the old and the new value) on each change of this observable value.

combineback to summary
public static <A, B, R> Val<R> combine(ObservableValue<A> src1, ObservableValue<B> src2, BiFunction<? super A, ? super B, ? extends R> f)
combineback to summary
public static <A, B, C, R> Val<R> combine(ObservableValue<A> src1, ObservableValue<B> src2, ObservableValue<C> src3, TriFunction<? super A, ? super B, ? super C, ? extends R> f)
combineback to summary
public static <A, B, C, D, R> Val<R> combine(ObservableValue<A> src1, ObservableValue<B> src2, ObservableValue<C> src3, ObservableValue<D> src4, TetraFunction<? super A, ? super B, ? super C, ? super D, ? extends R> f)
combineback to summary
public static <A, B, C, D, E, R> Val<R> combine(ObservableValue<A> src1, ObservableValue<B> src2, ObservableValue<C> src3, ObservableValue<D> src4, ObservableValue<E> src5, PentaFunction<? super A, ? super B, ? super C, ? super D, ? super E, ? extends R> f)
combineback to summary
public static <A, B, C, D, E, F, R> Val<R> combine(ObservableValue<A> src1, ObservableValue<B> src2, ObservableValue<C> src3, ObservableValue<D> src4, ObservableValue<E> src5, ObservableValue<F> src6, HexaFunction<? super A, ? super B, ? super C, ? super D, ? super E, ? super F, ? extends R> f)
conditionOnback to summary
public default Val<T> conditionOn(ObservableValue<Boolean> condition)

Returns a new Val that only observes this Val when condition is true. More precisely, the returned Val observes condition whenever it itself has at least one observer and observes this Val whenever it itself has at least one observer and the value of condition is true. When condition is true, the returned Val has the same value as this Val. When condition is false, the returned Val has the value that was held by this Val at the time when condition changed to false.

conditionOnback to summary
public static <T> Val<T> conditionOn(ObservableValue<T> obs, ObservableValue<Boolean> condition)
conditionOnShowingback to summary
public default Val<T> conditionOnShowing(Node node)

Equivalent to conditionOn(ObservableValue) where the condition is that node is showing: it is part of a scene graph (Node#sceneProperty() is not null), its scene is part of a window (Scene#windowProperty() is not null) and the window is showing (Window#showingProperty() is true).

conditionOnShowingback to summary
public static <T> Val<T> conditionOnShowing(ObservableValue<T> obs, Node node)
constantback to summary
public static <T> Val<T> constant(T value)

Returns a constant Val that holds the given value. The value never changes and no notifications are ever produced.

createback to summary
public static <T> Val<T> create(Supplier<? extends T> computeValue, Observable... dependencies)
createback to summary
public static <T> Val<T> create(Supplier<? extends T> computeValue, EventStream<?> invalidations)
filterback to summary
public default Val<T> filter(Predicate<? super T> p)

Returns a new Val that holds the same value as this Val when the value satisfies the predicate and is empty when this Val is empty or its value does not satisfy the given predicate.

filterback to summary
public static <T> Val<T> filter(ObservableValue<T> src, Predicate<? super T> p)
flatMapback to summary
public default <U> Val<U> flatMap(Function<? super T, ? extends ObservableValue<U>> f)

Overrides default javafx.beans.value.ObservableValue.flatMap.

Returns a new Val that, when this Val holds value x, holds the value held by f(x), and is empty when this Val is empty.

flatMapback to summary
public static <T, U> Val<U> flatMap(ObservableValue<T> src, Function<? super T, ? extends ObservableValue<U>> f)
getOptback to summary
public default Optional<T> getOpt()

Returns an Optional describing the value currently held by this Val, or and empty Optional if this Val is empty.

getOrElseback to summary
public default T getOrElse(T defaultValue)

Returns the value currently held by this Val. If this Val is empty, defaultValue is returned instead.

Parameters
defaultValue:T

value to return if there is no value present in this Val.

getOrSupplyback to summary
public default T getOrSupply(Supplier<? extends T> defaultSupplier)

Like getOrElse(Object), except the default value is computed by defaultSupplier only when necessary.

Parameters
defaultSupplier:Supplier<? extends T>

computation to produce default value, if this Val is empty.

getOrThrowback to summary
public default T getOrThrow()

Returns the value currently held by this Val.

Exceptions
NoSuchElementException:
if there is no value present.
ifPresentback to summary
public default void ifPresent(Consumer<? super T> f)

Invokes the given function if this Val holds a (non-null) value.

Parameters
f:Consumer<? super T>

function to invoke on the value currently held by this Val.

invalidationsback to summary
public default EventStream<T> invalidations()

Returns a stream of invalidated values, which emits the invalidated value (i.e. the old value) on each invalidation of this observable value.

isEmptyback to summary
public default boolean isEmpty()

Inverse of isPresent().

isPresentback to summary
public default boolean isPresent()

Checks whether this Val holds a (non-null) value.

Returns:boolean

true if this Val holds a (non-null) value, false otherwise.

mapback to summary
public default <U> Val<U> map(Function<? super T, ? extends U> f)

Overrides default javafx.beans.value.ObservableValue.map.

Returns a new Val that holds a mapping of the value held by this Val, and is empty when this Val is empty.

Parameters
f:Function<? super T, ? extends U>

function to map the value held by this Val.

mapback to summary
public static <T, U> Val<U> map(ObservableValue<T> src, Function<? super T, ? extends U> f)
mapDynamicback to summary
public default <U> Val<U> mapDynamic(ObservableValue<? extends Function<? super T, ? extends U>> f)

Like map(Function), but also allows dynamically changing map function.

mapDynamicback to summary
public static <T, U> Val<U> mapDynamic(ObservableValue<T> src, ObservableValue<? extends Function<? super T, ? extends U>> f)
observeChangesback to summary
public default Subscription observeChanges(ChangeListener<? super T> listener)

Adds a change listener and returns a Subscription that can be used to remove that listener.

observeChangesback to summary
public static <T> Subscription observeChanges(ObservableValue<? extends T> obs, ChangeListener<? super T> listener)
observeInvalidationsback to summary
public default Subscription observeInvalidations(Consumer<? super T> oldValueObserver)
observeInvalidationsback to summary
public static Subscription observeInvalidations(ObservableValue<?> obs, InvalidationListener listener)
orElseback to summary
public default Val<T> orElse(ObservableValue<T> other)

Overrides default javafx.beans.value.ObservableValue.orElse.

Returns a new Val that holds the value held by this Val, or the value held by other when this Val is empty.

orElseback to summary
public static <T> Val<T> orElse(ObservableValue<? extends T> src, ObservableValue<? extends T> other)
orElseConstback to summary
public default Val<T> orElseConst(T other)

Returns a new Val that holds the value held by this Val, or other when this Val is empty.

orElseConstback to summary
public static <T> Val<T> orElseConst(ObservableValue<? extends T> src, T other)
pinback to summary
public default Subscription pin()
removeInvalidationObserverback to summary
public default void removeInvalidationObserver(Consumer<? super T> observer)
removeListenerback to summary
public default void removeListener(InvalidationListener listener)

Implements javafx.beans.Observable.removeListener.

Doc from javafx.beans.Observable.removeListener.

Removes the given listener from the list of listeners, that are notified whenever the value of the Observable becomes invalid.

If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.

Annotations
@Override
removeListenerback to summary
public default void removeListener(ChangeListener<? super T> listener)

Implements javafx.beans.value.ObservableValue.removeListener.

Doc from javafx.beans.value.ObservableValue.removeListener.

Removes the given listener from the list of listeners that are notified whenever the value of the ObservableValue changes.

If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.

Annotations
@Override
selectVarback to summary
public default <U> Var<U> selectVar(Function<? super T, ? extends Property<U>> f)

Similar to flatMap(Function), except the returned Val is also a Var. This means you can call setValue() and bind() methods on the returned value, which delegate to the currently selected Property.

As the value of this Val changes, so does the selected Property. When the Var returned from this method is bound, as the selected Property changes, the previously selected Property is unbound and the newly selected Property is bound.

Note that if the currently selected Property is null, then calling getValue() on the returned value will return null regardless of any prior call to setValue() or bind().

selectVarback to summary
public default <U> Var<U> selectVar(Function<? super T, ? extends Property<U>> f, U resetToOnUnbind)
selectVarback to summary
public static <T, U> Var<U> selectVar(ObservableValue<T> src, Function<? super T, ? extends Property<U>> f)
selectVarback to summary
public static <T, U> Var<U> selectVar(ObservableValue<T> src, Function<? super T, ? extends Property<U>> f, U resetToOnUnbind)
showingPropertyback to summary
public static Val<Boolean> showingProperty(Node node)

Returns a Val whose value is true when node is showing: it is part of a scene graph (Node#sceneProperty() is not null), its scene is part of a window (Scene#windowProperty() is not null) and the window is showing (Window#showingProperty() is true).

suspendableback to summary
public default SuspendableVal<T> suspendable()
suspendableback to summary
public static <T> SuspendableVal<T> suspendable(ObservableValue<T> obs)
valuesback to summary
public default EventStream<T> values()

Returns a stream of values of this Val. The returned stream emits the current value of this Val for each new subscriber and then the new value whenever the value changes.

wrapback to summary
public static <T> Val<T> wrap(ObservableValue<T> obs)

Returns a Val wrapper around ObservableValue. If the argument is already a Val<T>, no wrapping occurs and the argument is returned as is. Note that one rarely needs to use this method, because most of the time one can use the appropriate static method directly to get the desired result. For example, instead of

Val.wrap(obs).orElse(other)

one can write
Val.orElse(obs, other)

However, an explicit wrapper is necessary if access to observeInvalidations(Consumer), or invalidations() is needed, since there is no direct static method equivalent for them.