Thumbnail image

Handling Null Values: The Power of Optional in Java

According to Oracle, “Java 8 Optional works as a container type for the value which is probably absent or null. Java Optional is a final class present in the java.util package.

**The question is: What is an Optional?

In java 8, they introduced a new class Optional<T> in the java.util package.