I have an enum:
public enum Status{
A("A"),
B("B"),
C("C"),
D("D"),
E("E")
}
A,B,C are in one category and D&E are a different category. Now when I get a string, I want to decide which category it falls in. Basically,
String s;
if s.equals( Status.A.toString()) || s.equals(Status.B.toString()) || s.equals( Status.C.toString())
return 1;
else return 2;
Now, this is manageable with 5 letters. If I have 26 letters, the number of if conditions will be unmanageable. Is there a better way to write this?