-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Replace the nullable annotations with guava's Optional class. #9
Comments
I don't use Guava's Optional because it's not a proper monad and so you end up writing a lot of boilerplate code everywhere to deal with Optionals. I prefer Java 8's Optional, but it's too early to require Java 8 (plus optionals/monads are still a pain to work with prior to lambdas). |
Ow, ok. |
I was going to leave the ticket open in case there was a demand to switch over. |
I do not think there is demand to switch over, but okay. 😄 |
I would prefer use of the Optional class over nullables. |
👎 |
What's the point of Guava's Optional class?
Probably the single biggest disadvantage of null is that it's not obvious what it should mean in any given context: it doesn't have an illustrative name. It's not always obvious that null means "no value for this parameter" -- heck, as a return value, sometimes it means "error", or even "success" (!!), or simply "the correct answer is nothing". Optional is frequently the concept you actually mean when you make a variable nullable, but not always.
more: http://stackoverflow.com/questions/9561295/whats-the-point-of-guavas-optional-class
Optional class: http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/base/Optional.html
Example in
com.sk89q.intake.argument.Namespace
The text was updated successfully, but these errors were encountered: