-
Notifications
You must be signed in to change notification settings - Fork 134
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
Prefer Optional::orElseThrow over Optional::get #2950
base: develop
Are you sure you want to change the base?
Conversation
Generate changelog in
|
@@ -0,0 +1,5 @@ | |||
type: improvement | |||
improvement: | |||
description: Prefer Optional::orElseThrow over Optional::get |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open question: Do we also want a more generic PreferOptionalOrElseThrow
check to rewrite Optional::get
& opt.get()
to Optional::orElseThrow
& opt.orElseThrow()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be in favor of this. Especially to fix consumers that have already applied StreamFlatMapOptional
.
I'm in favor of this, but would like @carterkozak to weigh in. |
I suppose I'd mentally modeled |
I've come to prefer
|
|
Given JDK-8160606, I agree. I suspect you're right that Unfortunately it seems that |
Before this PR
#2946 (comment)
After this PR
==COMMIT_MSG==
Prefer Optional::orElseThrow over Optional::get
==COMMIT_MSG==
Possible downsides?