Constructs a Var from an initial value plus an event stream of changes.
Constructs a Var from an initial value plus an event stream of changes. Note that this eagerly subscribes to the event stream; it is unsubscribed whenever the returned Var is collected.
Create a new, updatable Var with an initial value.
Create a new, updatable Var with an initial value. We call such Vars independent -- derived Vars being dependent on these.
Create a new Var whose values are provided asynchronously by
update
.
Create a new Var whose values are provided asynchronously by
update
. The returned Var is dormant until it is observed:
update
is called by-need. Such observations are also reference
counted so that simultaneous observations do not result in
multiple invocations of update
. When the last observer stops
observing, the com.twitter.util.Closable returned
from update
is closed. Subsequent observations result in a new
call to update
.
empty
is used to fill the returned Var until update
has
provided a value. The first observation of the returned Var is
synchronous with the call to update
--it is guaranteed the the
opportunity to fill the Var before the observer sees any value
at all.
Updates from update
are ignored after the returned
com.twitter.util.Closable is closed.
Collect a List of Vars into a new Var of List.
Collect a List of Vars into a new Var of List.
a java.util.List of Vars
a Var[java.util.List[A]] containing the collected values from vars.
Collect a collection of Vars into a Var of collection.
Patch reconstructs a Var based on observing the incremental changes presented in the underlying Diffs.
Sample the current value of this Var.
Sample the current value of this Var. Note that this may lead to surprising results for lazily defined Vars: the act of observing a Var may be kick off a process to populate it; the value returned from sample may then reflect an intermediate value.
Create a new, constant, v-valued Var.
Note: There is a Java-friendly API for this object: com.twitter.util.Vars.