The values in my enum
are words that need to have spaces in them, but enums can\'t have spaces in their values so it\'s all bunched up. I want to override
How about a Java 8 implementation? (null can be replaced by your default Enum)
public static RandomEnum getEnum(String value) {
return Arrays.stream(RandomEnum.values()).filter(m -> m.value.equals(value)).findAny().orElse(null);
}
Or you could use:
...findAny().orElseThrow(NotFoundException::new);