dimanche 1 juillet 2018

Java8 enum avoid multiple if else

In java 8 is there any option to avoid multiple if else check with enum value and to execute particular operation. I dont like to use some thing like below example ?

if enum equals A 
 PRINT A
else if enum equals B
 PRINT B
else if enum equlas C
 PRINT C

Aucun commentaire:

Enregistrer un commentaire