Skip to content

new method for ignoreElements then other observable? #3113

@davidmoten

Description

@davidmoten

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

a.ignoreElementsThen(b);

Any support for this new method (or is there an idiom I'm missing for this use case)?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions