-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Add orThrow and orDefault methods to Index #741
Add orThrow and orDefault methods to Index #741
Conversation
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.
oops, didn't see this second commit
addressed those requested changes and the check style errors |
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.
Thanks for the PR!
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.
thanks!
Adds orThrow and orDefault methods to Index. It was kind of annoying how Index#key and Index#value were marked as Nullable when in certain situations you know that they won't return nullable. Like
NamedTextColor.NAMES.key(NamedTextColor.RED)
. These orThrow methods are just helpers to avoid wrapping calls in requireNonNulls or ignoring warnings.Also added orDefault methods since that's a common map need.