@@ -0,0 +1,593 @@
+package com.yxy.chukonu.java.jdk18.func.optional;%0A%0Aimport java.util.Optional;%0A%0Apublic class OptionalExample %7B%0A%0A%09public static void main(String%5B%5D args) %7B%0A//%09%09String str = %22bam%22 ;%0A//%09%09Optional%3CString%3E optional = Optional.of(str);%0A%09%09String val = null ;%0A%09%09Optional%3CString%3E optional = Optional.ofNullable(val) ;%0A%0A%09%09System.out.println(optional.isPresent());           // true%0A%09%09if(optional.isPresent())%7B%0A%09%09%09System.out.println(optional.get());        %0A%09%09%09System.out.println(optional.orElse(%22fallback%22));    // %22bam%22%0A%09%09%7D%0A%09%09optional.ifPresent((s) -%3E System.out.println(s.charAt(0)));     // %22b%22%0A%0A%09%7D%0A%0A%7D%0A

add JDK1.8 new feature - Optional