Given the following java enum:
public enum AgeRange { A18TO23 { public String toString() { return \"18 - 23\"; } },
for (AgeRange ar: EnumSet.allOf(AgeRange)) { if (ar.toString().equals(inString)) { myAnswer = ar; break; } }
Or something like that? Just typed in, haven't run through a compiler. Forgive (comment on) typos...
Or use logic like this to build a map once. Avoid iteration at runtime. Good idea, Jon.