0
条件の後に追加した場合、RxJavaが3番目の完了(completable3
)を実行しないのはなぜですか?条件付きで完了したチェーン
私は、チェーンが壊れているように見える唯一のケースではないことに気づいたので、以下のコードが期待通りに実行されない根本的な理由を知りたいと思います。私は私のようなもの行うことができます知っている
Completable chain = completable1
.andThen(completable2);
if(condition)
chain.andThen(completable3);
chain.subscribe();
:RxJavaに
completable1
.andThen(completable2);
.andThen(Completable.defer(() => {
if(condition)
return completable3;
else
return Completable.complete();
}))
.subscribe();
:最初たとえば、
andThen
によって返された変調インスタンスを持つチェーンの参照を置き換えることができます。ありがとう! – ingkevin