Reactive lazy evaluation (memoization)
ReactiveLazy is a reactive adapter
that implements lazy evaluation
(or memoization) while preserving reactivity, i.e. ability to respond to change.
ReactiveLazy computes its value upon first read
by calling its Supplier
and then keeps returning the same cached value.
The difference from non-reactive implementations is that ReactiveLazy will reset itself to uninitialized state when dependencies change.
When this happens, dependent reactive computations are woken up, so that they can request new value.
ReactiveLazy is a reactive intermediary. It can be used as a single-value reactive cache.
Download
ReactiveLazy is included in core library.
Documentation
See the ReactiveLazy class in javadoc.
Since the javadoc is not complete yet, you might want to take a look at comments and implementation
in ReactiveLazy.java.