I would like to apply subscribeOn based on the condition on Observables.
For example in the below code
Observable.just("One", "Two", "Three")
.flatMap(v ->
performLongOperation(v)
.doOnNext(s -> System.out.println("processing item on thread " + Thread.currentThread().getName()))
.subscribeOn(Schedulers.newThread()) //I want to apply this if a condition is true. Otherwise run on the main thread
)
.subscribe(item -> System.out.println(item));