vendredi 28 juillet 2017

Java 8 Optional instead of if

Hello I have problem with Optional and I don't know how to handle it.

public void check(String name){
   if(name != null)
      doSomething(name);
   else 
      doMore();
} 

How to change this if into Optional? Thanks in advance for help

Aucun commentaire:

Enregistrer un commentaire