Enum

Java ENUM is not like C++. You can not using '&&' or '||' to handle a enum collection (because enum value is a string in java) but you can use EnumSet.

enum Master {
    GOBLIN, ORC, OGRE;
}
public class Main {
    public static void main(final String[] args) 
    {
        final EnumSet bigGuys = EnumSet.of(Master.ORC, Master.OGRE);
        for (final Monster act : Monster.values()) {
            System.out.println(bigGuys.contains(act));
        }
    }
}

results matching ""

    No results matching ""