I'm trying to set up my enum so that it has a list of names and retrieve a particular name given that value.
Example: enum {Vanilla, Chocolate, Strawberry};
Given 0, return Vanilla. Given 1, return Chocolate. Given 2, return Strawberry.
I haven't been able to find any methods that come with the Java Enum class to do this out of the box. I'm thinking of writing my own that dumps the values into an array and then use binary search to return them, given a particular number.
Is there something built in however that would be better?
Thanks!