You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The basic Java Enum class does not have methods to compare against CharSequence, e.g. that come from user input in a web form or similar. For example, I'd like to be able to do this:
// userSuppliedColor is a Stringif (Color.RED.equalsString(userSuppliedColor)) {
...
}
or this:
if (Color.RED.equalsStringIgnoringCase(userSuppliedColor)) {
...
}
Alas, Java doesn't provide such methods, and amazingly I cannot find anything that does this in Google Guava or Apache Commons. It seems like this is something relatively common to want to do. Anyway, I guess we'll add our own which will at a minimum allow:
comparisons of a single enum constant to a CharSequence in either case-sensitive or case-insensitive manner
comparison of a CharSequence against multiple enum constants in case-sensitive or case-insensitive manner
The text was updated successfully, but these errors were encountered:
The basic Java
Enum
class does not have methods to compare againstCharSequence
, e.g. that come from user input in a web form or similar. For example, I'd like to be able to do this:or this:
Alas, Java doesn't provide such methods, and amazingly I cannot find anything that does this in Google Guava or Apache Commons. It seems like this is something relatively common to want to do. Anyway, I guess we'll add our own which will at a minimum allow:
CharSequence
in either case-sensitive or case-insensitive mannerCharSequence
against multiple enum constants in case-sensitive or case-insensitive mannerThe text was updated successfully, but these errors were encountered: