I have an enum like this:
public enum SomeEnum
{
ENUM_VALUE1("Some value1"),
ENUM_VALUE2("Some value2"),
ENUM_VALUE3("Some value3");
}
I need to store values of enum Some value1, Some value2 and Some value3 in an ArrayList.
I can get all values in an array using SomeEnum.values() and iterate over that array and store the value in an ArrayList like this:
SomeEnum values[] = SomeEnum.values();
ArrayList<SomeEnum> someEnumArrayList = new ArrayList<SomeEnum>();
for(SomeEnum value:values)
{
someEnumArrayList.add(value.getValue());
}
Is there any other method like values() that returns array of Some value1, Some value2 and Some value3?
Arrays.asList(values)which returns a list.