Optional Class
Learn about the `Optional` class in Java.
Introduction
Java 8 comes with the Optional
class in the java.util
package for avoiding null return values (and thus NullPointerException
). It is very similar to Google Guava’s Optional
, which is similar to Nat Pryce’s Maybe
class and Scala’s Option
class.
Billion Dollar Mistake: Tony Hoare, the inventor of
null
, has gone on record calling it his “billion-dollar mistake.” Despite your opinion ofnull
, many efforts ...
Access this course and 1400+ top-rated courses and projects.