RxJava Return single, execute completable after

前端 未结 4 539
一生所求
一生所求 2021-02-13 18:58

I\'m trying to accomplish the following: Return some data as single, execute a completable after. The following code does not compile due to single.andThen(). The actions need t

4条回答
  •  梦如初夏
    2021-02-13 20:02

    Assuming you actually want to return the Single after the Completable, here's another way:

    Using Java:

    single.flatMap(x -> completable.toSingleDefault(x))
    

    Using Kotlin:

    single.flatMap { completable.toSingleDefault(it) }
    

提交回复
热议问题