0

This is a early construct of my class:

public class Player {
    public enum Tech {
        NONE(EnumSet.noneOf(Tech.class)),
        VEGETATION(EnumSet.of(NONE)),
        LIVESTOCK(EnumSet.of(NONE)),
        STRAWBERRIES(EnumSet.of(VEGETATION)),
        BIODOME(EnumSet.of(STRAWBERRIES)),
        BIOMASS(EnumSet.of(VEGETATION, LIVESTOCK));

        private final Set<Tech> prerequisites;

        Tech(Set<Tech> prerequisites) {
            this.prerequisites = prerequisites;
        }
    }
    private Set<Tech> techsKnown;

    public Player() {
        techsKnown = EnumSet.of(Tech.NONE);
    }
}

I want NONE to have an empty Set. What would be the best way?

Symlink
  • 383
  • 2
  • 12
  • Can you share your stacktrace? – Mureinik Feb 16 '18 at 11:04
  • java.lang.ExceptionInInitializerError at Player.(Player.java:21) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeMethod) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at bluej.runtime.ExecServer$3.run(ExecServer.java:746) – Symlink Feb 16 '18 at 11:11
  • i couldnt post the full stacktrace. For the full stacktrace you may copy paste the code and execute it – Symlink Feb 16 '18 at 11:23

0 Answers0