applyEvents

fun <STATE, EVENT> applyEvents(stateEvolver: Evolver<EVENT, STATE>, initialState: STATE?, eventStream: List<EVENT>): STATE

Perform a left-fold over the eventStream using the initialState as the initial state

Return

the initial state with all events applied to it

Parameters

stateEvolver

the state evolver (that applies events to the state)

initialState

the initial state provided to the state evolver

eventStream

the stream of Events supplied one by one (in-order) to the state evolver

EVENT

The type of Events that can be applied in the .applyEvent

STATE

The type of aggregate/projection/view STATE that .applyEvent supports