Package rsp.state
Interface FunctionConsumer<S>
-
- Type Parameters:
S- the type of the state snapshot, an immutable class
- All Known Subinterfaces:
UseState<S>
- All Known Implementing Classes:
MutableState,ReadOnly
public interface FunctionConsumer<S>Represents a write state snapshot operation using the result of a function which transforms the current state to a new state. The function execution and write may be performed with synchronization, making the state update atomic.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaccept(Function<S,S> function)Writes the new state with the result of the function.voidacceptOptional(Function<S,Optional<S>> function)Writes the new state with the result of the function if the result is not empty.
-