I have a class that defines a Map<Integer, String> commands
variable, wherein the Integer is the command number and the String is the name for it.
The reason I didn't make this an enum
is that I was under the impression that values in an enum
have to be sequential, id est increment by one (but the command keys don't). Having looked at the below code, I'm of the impression that this assumption of mine is wrong:
public enum HttpStatusCode {
OK(200), NO_CONTENT(204), NOT_FOUND(404) /* .... */ ;
}
Do the values in an enum have to increment by one for each value or are gaps in value allowed?