Skip to content

Instantly share code, notes, and snippets.

@odornauf
Last active July 5, 2018 05:17
Show Gist options
  • Save odornauf/2971c085b519737616cd1a097f80aec1 to your computer and use it in GitHub Desktop.
Save odornauf/2971c085b519737616cd1a097f80aec1 to your computer and use it in GitHub Desktop.
Java Enums with String values.
public enum aEnum {
aValue ("value"),
aOtherValue ("string for value"),
aAddValue ("another value");
private final String name;
private aEnum(String name) {
this.name = name;
}
public boolean equalsName(String otherName) {
return name.equals(otherName);
}
public String toString() {
return this.name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment