Java8 enum avoid multiple if else
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 Is it possible you're looking for switch statements? – Silvio Mayolo Jul 1 at 17:37 You do not need to check the equality if the operation is always the same – Yassin Hajaj Jul 1 at 18:06 2 Answers 2 Define enum with abstract method and provide it's implementation with values. enum MyEnum{ A{ @Override...