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:
<
I don't think there is, but you can do something like this:
enum choices {a1, a2, b1, b2};
public static boolean exists(choices choice) {
for(choice aChoice : choices.values()) {
if(aChoice == choice) {
return true;
}
}
return false;
}
Edit:
Please see Richard's version of this as it is more appropriate as this won't work unless you convert it to use Strings, which Richards does.