isPresent() method of Optional object in Java

This method will check whether an Optional object is not empty? If this object is empty, it returns false.

For example:

Result:

isPresent() method of Optional object in Java

Add Comment