Here\'s my problem - I\'m looking for (if it even exists) the enum equivalent of ArrayList.contains();.
Here\'s a sample of my code problem:
<
You can make it as a contains method:
enum choices {a1, a2, b1, b2};
public boolean contains(String value){
try{
EnumSet.allOf(choices.class).contains(Enum.valueOf(choices.class, value));
return true;
}catch (Exception e) {
return false;
}
}
or you can just use it with your code block:
try{
EnumSet.allOf(choices.class).contains(Enum.valueOf(choices.class, "a1"));
//do something
}catch (Exception e) {
//do something else
}