RX Java – chain can be completed to observable stream

Suppose you want to insert a complete in the observable chain. For example, for each issued element, there is a runnable block and blocked before it is completed. Which option would you choose? (complete. Complete () here is an example)

> . flatMap {Completable.complete().andThen(Observable.just(it))} > . Doonnext {complete. Complete(). Blockingawait()} > what else?

Solution

.flatMapCompletable { Completable.complete().andThen(Observable.just(it)) } // If you don't want it to return
.flatMapCompletable { Completable.complete().andThen(Observable.just(it)) } // If you don't want it to return
.flatMap { Completable.complete().andThen(Observable.just(it)) } //Can be used if you want it to return Observable
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>