RxJava: How to conditionally apply Operators to an Observable without breaking the chain
You can use compose(Func1)
to stay in-sequence but do custom behavior
source
.compose(o -> condition ? o.map(v -> v + 1) : o.map(v -> v * v))
.filter(...)
.subscribe(...)