-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New operators: concatEmptyWith
and mergeEmptyWith
#3430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
As discussed in issue ReactiveX#3037, the primary use of these operators is to be applied to `Observable<Void>` so that they can be merged and concatenated with an Observable of a different type. Both these operators raise an error if the source Observable emits any item.
This is a replacement for #3060 |
👍 |
I've been thinking about these operators and it feels odd they have to throw if the source is not empty. Regardless, do you think if it is possible to factor out this error behavior into a separate operator, let's say |
The idea for these operators is to combine two streams of different types ( Would public <R> Observable<R> none(); |
It could, although that might not help due to problems with Java type inference in various Java versions (and IDEs); I got surprised a few times. Certainly, I like the inlined nature of this PR so no pressure on |
|
Great. (If you wish, you can try |
Could we also close this PR if we add |
That might not be binary compatible. I've checked it and changing the type parameter creates a compilation error in |
I add 👍 to @akarnokd solution |
Closing this PR in favor of converting an obs.doOnNext(this::blowUp).toCompletable().endsWith(nextObservable); Note that the operator names in Completable are subject to change as it has not yet been released. See #3570. If you think this case is not handled then feel free to re-open. |
As discussed in issue #3037, the primary use of these operators is to be applied to
Observable<Void>
so that they can be merged and concatenated with an Observable of a different type.Both these operators raise an error if the source Observable emits any item.