I have the following listing in Objective-C:
typedef enum { APIErrorOne = 1, APIErrorTwo, APIErrorThree, APIErrorFour } APIErrorCode;
I use indexes to reference an enumeration from xml, for example xml may have error = 2 , which maps to APIErrorTwo
My thread - I get an integer from xml and run the switch statement as follows:
int errorCode = 3 switch(errorCode){ case APIErrorOne:
Java seems to dislike this kind of enumeration in the switch statement:

In Java, it seems like you cannot assign indexes to enum members. How can I get the Java equivalent from the above?
source share