I saw it suggested on a blog that the following was a reasonable way to do a \"reverse-lookup\" using the getCode(int)
in a Java enum:
public en
Both ways are perfectly valid. And they have technically the same Big-Oh running time.
However, if you save all of the values to a Map first, you save the time it takes to iterate through the set each time you want to do a lookup. So, I think that the static map and initializer are a slightly better way to go.