JAVA EnumSet

阅读更多
public class enumSet {

	enum ALPH {M,D,F,A,E,G,W,S};
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		EnumSet all = EnumSet.allOf(ALPH.class);
		EnumSet none = EnumSet.noneOf(ALPH.class);
		EnumSet range = EnumSet.range(ALPH.A, ALPH.G);
		EnumSet some = EnumSet.of(ALPH.D,ALPH.F);
		
		//System.out.println(all+"\n"+none+"\n"+range+"\n"+some);
		
		for(ALPH a : all){
			System.out.println(a);
		}
		
		if(all.contains(ALPH.A)){
			System.out.println("sure");
		}
	}

}

你可能感兴趣的:(java,enumset)