RxJava/RxKotlin: combineLatest that already completes if one source completes (not all)
问题 Basically, I have two Flowables F and G and I want to use combineLatest on them, but I want the combined Flowable to already complete if F completes (even if G is still running). Here is an example of what I what to achieve with an ugly solution: fun combineFandGbutTerminateIfFTerminates(F: Flowable<Int>, G: Flowable<Int>) : Flowable<Pair<Int, Int>> { val _F = F.share() val _G = G.takeUntil(_F.ignoreElements().toFlowable<Nothing>()) val FandG = Flowables.combineLatest(_F, _G) return FandG }