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

FR: warn on Optional.flatMap(v -> Optional.ofNullable(fn(v))) #1326

Closed
markelliot opened this issue Apr 29, 2020 · 1 comment
Closed

FR: warn on Optional.flatMap(v -> Optional.ofNullable(fn(v))) #1326

markelliot opened this issue Apr 29, 2020 · 1 comment

Comments

@markelliot
Copy link
Contributor

What happened?

Optional#map coerces nulls to empty, so it's redundant to say Optional.flatMap(v -> Optional.ofNullable(fn(v))).

What did you want to happen?

Errorprone should tell me to write Optional.map(fn).

@carterkozak
Copy link
Contributor

I like it, great idea

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

No branches or pull requests

2 participants