Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java check if enum contains value

The EnumUtils class has a method called isValidEnum whichChecks if the specified name is a valid enum for the class. It returns a boolean true if the String is contained in the Enum class, and a boolean false otherwise.



EnumUtils.isValidEnum(Day.class, "MONDAY")
 
PREVIOUS NEXT
Tagged: #java #check #enum
ADD COMMENT
Topic
Name
6+2 =