Interface State

All Superinterfaces:
Observable<Boolean>, ObservableState, Observer<Boolean>, Value<Boolean>

public interface State extends ObservableState, Value<Boolean>
A class encapsulating a boolean state, non-nullable with null values translated to false.
 State state = State.state();

 ObservableState observable = state.observable();

 observer.addConsumer(this::onStateChange);

 state.set(true);
 state.set(false);
 state.set(null); //translates to false
A factory for State instances.

Thread Safety: Listener management (add/remove) is thread-safe and supports concurrent access. However, state modifications via Value.set(Object) are NOT thread-safe and should be performed from a single thread (such as an application UI thread).

See Also: