This method will check whether an Optional object is not empty? If this object is empty, it returns false.
For example:
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | package com.huongdanjava.javaexample; import java.util.Optional; public class Example { 	public static void main(String[] args) { 		String s = new String("Khanh"); 		Optional<String> opt = Optional.ofNullable(s); 		System.out.println(opt.isPresent()); 	} } | 
Result:

 
 
