I've bumped into this use case as few times where I want to ignore all elements of Observable<T> a and then return Observable<R> b. This is how I normally do it:
a.ignoreElements().castAs(R.class).concatWith(b);
If R is a generic type we are forced into a more verbose cast:
((Observable<R>)(Observable<?>) a.ignoreElements()).concatWith(b);
What I don't like about this is that it's hard to read and I wonder if a new method say Observable.ignoreElementsThen would be a good addition to the API. It's signature would be
public <R> Observable<R> ignoreElementsThen(Observable<R> observable);
The use case would then be expressed as
Any support for this new method (or is there an idiom I'm missing for this use case)?