Be careful with "casting" ints to Enum types, and vice versa. You can use ordinal() to work out the ordering of an Enum type, but
you should never use it to convert between the two.
The reverse is true as well. You shouldn't derive an Enum from an integer value, unless you associate this value with the Enum; for instance with a constructor:
This way you can get an Enum by calling MyEnum.fromValue(int) and you can convert back to the value with someMyEnum.value().
This seems like a roundabout way to do it, but it means that if you later insert another MyEnum instance in your list, your values will remain the same, even if the ordinal() value changes.