RxJava: run a list of completables until one succeeds
I have a function which takes a single input and returns a Completable.
I would like to run the function sequentially on a list of candidate inputs until I find one for which the Completable completes without an error.
fun doStuff(input: Int): Completable { ... }
Observable.just(1,2,3,4)
.flatMapCompletable { doStuff(it) }
.??? // Run completables until one succeeds
I'm not using merge or concat because they will execute all the Completables. I want it to stop...