I'm trying to avoid the traditional if / else block by using Java Optional. But I still missing the understanding of how to implement the next requirement :
    if (x != null)
       foo1();
    else
       foo2();
public void foo1(){
   print("X not null");
}
public void foo2(){
   print("X is null");
}
thanks
 
     
    