corda / net.corda.client.fxutils / rx.Observable / fold

# fold

`fun <T, R> Observable<T>.fold(accumulator: R, folderFun: (R, T) -> Unit): R`

fold takes an rx.Observable stream and applies fold function on it, and collects all elements using the accumulator.

### Parameters

`accumulator` - The accumulator for accumulating elements.

`folderFun` - The transformation function to be called on the observable list when a new element is emitted on the stream, which should modify the list as needed.