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

3.x: Swap Maybe.flatMapSingle and Maybe.flatMapSingleElement ? #6878

Closed
akarnokd opened this issue Jan 26, 2020 · 2 comments · Fixed by #6891
Closed

3.x: Swap Maybe.flatMapSingle and Maybe.flatMapSingleElement ? #6878

akarnokd opened this issue Jan 26, 2020 · 2 comments · Fixed by #6891

Comments

@akarnokd
Copy link
Member

Currently, flatMapSingle returns Single and signals NoSuchElementException if the source Maybe is empty. flatMapSingleElement remains Maybe.

I'd consider renaming flatMapSingle to flatMapSingleOrError and flatMapSingleElement to flatMapSingle as I think a default Maybe -> Maybe transformer should better match the other such transformers.

Alternatively, drop flatMapSingle and rename flatMapSingleElement to flatMapSingle so that the original behavior could be achieved via flatMapSingle.toSingle()).

@slisaasquatch
Copy link
Contributor

Personally I'm in favor of dropping the old flatMapSingle and renaming flatMapSingleElement, because I found the behavior of the old flatMapSingle surprising at first, and using toSingle().flatMap() is more readable.

@akarnokd
Copy link
Member Author

akarnokd commented Jan 28, 2020

Let's drop flatMapSingle and rename flatMapSingleElement.

@slisaasquatch would you like to post a PR? If so, please keep the unit tests and use flatMapSingle().toSingle().

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

Successfully merging a pull request may close this issue.

2 participants