Optional is a new feature introduced in java 8. The main purpose of "Optional" is to avoid too many null checks and NullPointerException to make the source code clean and well organized! The optional class belongs to java.util package and it may or may not hold a null value.
- Null checks are not required
- No more NullPointerException
- Create clean and neat code
- Avoid boiler plate code