public interface RxLockBox<T> extends LockBox<T>, RxBox<T>
Modifier and Type | Method and Description |
---|---|
default RxLockBox<T> |
enforce(Function<? super T,? extends T> enforcer)
Provides a mechanism for enforcing an invariant on an existing
`RxBox`.
|
default <R> RxLockBox<R> |
map(Converter<T,R> converter)
RxLockBox must map to another kind of LockBox.
|
static <T> RxLockBox<T> |
of(T value)
Creates an `RxLockBox` containing the given value, which uses itself as the lock.
|
static <T> RxLockBox<T> |
of(T value,
Object lock)
Creates an `RxLockBox` containing the given value, which uses `lock` as the lock.
|
lock, modify, transactOn
combineLatest, from, fromVolatile, map
asObservable, subscribe, wrap
accept, from, ofVolatile, set
static <T> RxLockBox<T> of(T value)
static <T> RxLockBox<T> of(T value, Object lock)
default <R> RxLockBox<R> map(Converter<T,R> converter)
default RxLockBox<T> enforce(Function<? super T,? extends T> enforcer)
RxBox
RxLockBox
can still be
modified atomically).
Conflicting calls to `enforce` can cause an infinite loop, see Breaker
for a possible solution.
```java
// this will not end well...
RxBox.of(1).enforce(Math::abs).enforce(i -> -Math.abs(i));
```