Browse - Programming Tips - Java: How can I covert a String to/from an enum?

Date: 2017dec8
Language: java

Q.  Java: How can I covert a String to/from an enum?

A.  String to enum:

MyEnum e = MyEnum.valueOf(mystr);
enum to String:
String str = e.toString();