これは私のクラスの初期の構成です:
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);
}
}
NONE に空のセットを持たせたい。最善の方法は何ですか?