runningFoldToSet
fun <V : Any> Flow<SetEvent<V>>.runningFoldToSet(emitPartials: Boolean = false, relaxed: Boolean = false): Flow<PersistentSet<V>>(source)
This method takes a flow of SetEvent and transforms it into a flow of Set. It uses a running fold operation to maintain the state of the set and emit the updated set whenever a relevant event is received.
Return
a flow of Set representing the updated state of the set after each event is received.
Parameters
emitPartials
if set to true
, an initial empty set will be emitted, followed by a set for each received EntryEvent prior to the Populated event being received. If set to false
, it will only emit the current set on the initial Populated and each following EntryEvent.
relaxed
if set to false
, it will throw an IllegalStateException in the following cases: