Skip to content
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

[2.x] Maybe.switchIfEmpty(CompletableSource) #6540

Closed
kevmo314 opened this issue Jun 24, 2019 · 4 comments
Closed

[2.x] Maybe.switchIfEmpty(CompletableSource) #6540

kevmo314 opened this issue Jun 24, 2019 · 4 comments

Comments

@kevmo314
Copy link

In the same vein as #4544, can we get Maybe.switchIfEmpty(CompletableSource)? It would be identical to maybe.switchIfEmpty(completable.toMaybe()).

@akarnokd
Copy link
Member

Is there a reason the manual application of toMaybe() is a problem for you? We usually don't add trivial or many conveninence operators.

@kevmo314
Copy link
Author

We have a CompletableSubject which doesn't have toMaybe(). But I guess more broadly, CompletableSource is looser and doesn't actually require toMaybe() to exist and it seems consistent with the other overloads of Maybe.switchIfEmpty().

@akarnokd
Copy link
Member

CompletableSubject extends Completable thus it has toMaybe, not sure why you have problems (maybe forgot to add the target type argument for the conversion?)

image

switchIfEmpty(Single) makes sense on its own as it return a Single expecting and implying there is going to be a success item or an error. Switching to a Completable doesn't change the return type and thus .toMaybe conversion won't introduce more conversions down the line like switchIfEmpty(Single.toMaybe()) would.

@kevmo314
Copy link
Author

Ah okay we figured out what was going on on our end. Thanks for the context behind SingleSource, that makes sense. I'll close this one out as .toMaybe() isn't a problem. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants