public interface RxGetter<T> extends IObservable<T>, Supplier<T>
Observable
.
`RxGetter`'s `Observable` has the semantics of a
BehaviorSubject
, meaning that as soon as a listener
subscribes to the `Observable`, it will emit the current value.
Any time the value changes, `RxGetter`'s `Observable` will notify of the change. If the value did not change (e.g. a field is set to its current value, which produces no change) then the `Observable` will not fire.
Modifier and Type | Method and Description |
---|---|
static <T1,T2,R> RxGetter<R> |
combineLatest(RxGetter<? extends T1> t,
RxGetter<? extends T2> u,
BiFunction<? super T1,? super T2,? extends R> combine)
Creates an `RxGetter` which combines two `RxGetter`s using the `BiFunction combine`.
|
static <T> RxGetter<T> |
from(Observable<T> observable,
T initialValue)
Creates an `RxGetter` from the given `Observable` and `initialValue`,
appropriate for observables which emit values on a single thread.
|
static <T> RxGetter<T> |
fromVolatile(Observable<T> observable,
T initialValue)
Creates an `RxGetter` from the given `Observable` and `initialValue`,
appropriate for observables which emit values on multiple threads.
|
default <R> RxGetter<R> |
map(Function<? super T,? extends R> mapper)
Maps an `RxGetter` to a new `RxGetter` by applying the `mapper` function
to all of its values.
|
asObservable, subscribe, wrap
default <R> RxGetter<R> map(Function<? super T,? extends R> mapper)
If the `Observable` of the source `RxGetter` changes, but the
`Function
static <T> RxGetter<T> fromVolatile(Observable<T> observable, T initialValue)
Supplier.get()
will be the last value emitted by
the observable, as recorded by a volatile field.static <T> RxGetter<T> from(Observable<T> observable, T initialValue)
Supplier.get()
will be the last value emitted by
the observable, as recorded by a non-volatile field.static <T1,T2,R> RxGetter<R> combineLatest(RxGetter<? extends T1> t, RxGetter<? extends T2> u, BiFunction<? super T1,? super T2,? extends R> combine)
map(java.util.function.Function<? super T, ? extends R>)
, the observable only emits a new value if its value has changed.