/** * Returns whether the given string is a valid element type name, and may be * passed to <code>ElementType.valueOf</code> without causing an exception. * * @param s The string * @return Whether the given string is a valid element type */ public static boolean contains(String s) { for (ElementType elementType : values()) { if (elementType.name().equals(s)) { return true; } } return false; }