reduce

fun <T> Observable<T>.reduce(reducer: (a: T, b: T) -> T): Maybe<T>

Returns a Maybe that subscribes to this Observable and calls the reducer function with a result of a previous reducer invocation and a current element. The returned Maybe emits a result of the final reducer invocation, or completes if the source Observable emitted less than two elements.

Please refer to the corresponding RxJava document.