?? testenumset.java
字號:
import java.util.*;
/**
* Description:
* <br/>Copyright (C), 2005-2008, Yeeku.H.Lee
* <br/>This program is protected by copyright laws.
* <br/>Program Name:
* <br/>Date:
* @author Yeeku.H.Lee kongyeeku@163.com
* @version 1.0
*/
public class TestEnumSet
{
public static void main(String[] args)
{
Collection c = new HashSet();
c.clear();
c.add(Season.FALL);
c.add(Season.SPRING);
//復制Collection集合中所有元素來創建EnumSet集合
EnumSet enumSet = EnumSet.copyOf(c);
//輸出[SPRING,FALL]
System.out.println(enumSet);
c.add("Struts2權威指南");
c.add("輕量級J2EE企業應用實戰");
//下面代碼出現異常:因為c集合里的元素不是全部都為枚舉值
enumSet = EnumSet.copyOf(c);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -