[java] Get enum values as List of String in Java 8

Is there any Java 8 method or easy way, which returns Enum values as a List of String, like:

List<String> sEnum = getEnumValuesAsString();

This question is related to java enums java-8

The answer is

You can do (pre-Java 8):

List<Enum> enumValues = Arrays.asList(Enum.values());


List<Enum> enumValues = new ArrayList<Enum>(EnumSet.allOf(Enum.class));

Using Java 8 features, you can map each constant to its name:

List<String> enumNames = Stream.of(Enum.values())

Similar questions with java tag:

Similar questions with enums tag:

Similar questions with java-8 tag: