1. Overview
In this tutorial, We'll learn how to perform an action if a value is present in Optional. Java 8 Optional ifPresent() does the job for us.
Instead of directly getting the value using get() method, first, it checks the condition value != null.
The old way is done using the isPresent() method as below. But, ifPresent is much simplified than isPresent().