This is about converting the enumeration values to a string array. I have an enumeration:
enum Weather {
RAINY, SUNNY, STORMY
}
And I want to convert this to a string array with minimal effort and no loops with Java 8+. This is the best I came up with:
Arrays.stream(Weather.values()).map(Enum::toString).toArray(String[]::new)
Any other and similarly or more convenient ways to do the same thing?