I wrote a series of posts about
Optional that I recommend you read in the following order:
Intention Revealing Code WithWrite intention revealing code with Java 8's new type
Optionaland prevent most NPEs. This is not optional!
The Design ofA digest of how
Optionalwas introduced in Java 8, summarizing the many discussions about it and their key points based on the mail archive of JSR-335.
Why Isn'tDiscussing the reasons for not making Java 8's new type
Then there are a few more posts on the topic that can be read in pretty much any order:
More Opinions OnHow much work is it to wrap
Optional? Do you need to
Optionalarguments? What about serializability and framework support? And why consider the type in the first place? Answers in here!
Where to use Optional - Inside Java Newscast #19#videoIs it ok to use
Optionalas parameter type? Overloading is an alternative, but how well does it stack up? Thoughts on this question (and other
Optional-related ones) can usually be put into one of three (and a half) categories.
nulland Upgrading Past Java 8 - Inside Java Newscast #7#video
nullis never fun, so in this newscast, I explain how to best handle it, what tools can do, and how recent and upcoming language changes help dealing with it. I'll also look at a recent blog post about how Netflix upgraded from Java 8 to 16.
Why Don't They Just... ?! The Deliberations Behind Evolving Java#talkThere are many nifty features that Java could have but doesn't. Somewhat surprisingly, there are reasons for that and in this talk I'll discuss those for a few concrete cases as well as the deliberations behind such decisions.
Java's Quirks and Wrong (?) Defaults with Brian Goetz#videoMutability, nullability, serialization, primitives - Nicolai Parlog discusses with Java language architect Brian Goetz why Java is the way it is.
Code-First Java 9 Tutorial#postShowing code for the most important Java 9 features: private interface methods, stream and optional APIs, collection factories, reactive streams, stack walking, multi-release JARs, redirected platform logging, unified logging, the module system, and more. If you're new to Java 9, start here.
Expert Java 8#talkWith this talk, I help you get the most out of lambdas,
Optionals, and default methods, helping you master Java 8's core features
Why Elvis Should Not Visit Java#postThe desire for the Elvis operator for easier null-handling echoes through the Java community. But due to Java's type system, it should never be introduced!
Java 9 Additions ToJava 9 is coming! One of the changes are new methods on Optional:
ifPresentOrElse(), which considerably improve Optional's API.
Java 8 SE Optional, a strict approach#postStephen Colebourne presented his pragmatic approach to using Optional. I argue for a stricter one that gets us further without considerable downsides.
Casting In Java 8 (And Beyond?)#postProposal to implement new casting methods on Java's
Class. They aim to fulfill the need for improved ways to cast which was created by Java 8.