
Java 8: Removing null checks with Optional - mariushe
http://www.deadcoderising.com/2015-10-06-java-8-removing-null-checks-with-optional/
======
EvenThisAcronym
"How to remove null checks and then add them back again as a library feature."

The difference being, of course, that having an Optional type forces you to
check if it's null or not before getting at the underlying object.

------
Shish2k
So we now have explicit optional to go with implicit optional. Still looking
for an explicit not-optional where the compiler will complain when a possibly-
null value is passed in :(

~~~
yarper
Something like the @NonNull annotation?

[https://blogs.oracle.com/java-platform-
group/entry/java_8_s_...](https://blogs.oracle.com/java-platform-
group/entry/java_8_s_new_type)

Edit: @NonNull rather than @NotNull. This annotation has existed in various
guises and frameworks for a while, usually as @NotNull which is is probably
why it's called @NonNull (avoiding breaking changes)

