我的步骤是:
Completable
所以我想这样做:
Single<Integer> result =
Single.fromCallable(() -> generate_x)
.COMPOSE_WITH_COMPLETABLE(x -> method_that_returns_completable(x))
.map(x -> x + 1) // i still need x here
如何实现它?
答案 0 :(得分:3)
single.flatMap(new Func1<Integer, Single<? extends Integer>>() {
@Override
public Single<? extends Integer> call(final Integer integer) {
return completable.toSingle(new Func0<Integer>() {
@Override
public Integer call() {
return integer;
}
});
}
})