本文整理匯總了Java中java.util.EnumSet.clear方法的典型用法代碼示例。如果您正苦於以下問題:Java EnumSet.clear方法的具體用法?Java EnumSet.clear怎麽用?Java EnumSet.clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.EnumSet
的用法示例。
在下文中一共展示了EnumSet.clear方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testEncodeUsageType
import java.util.EnumSet; //導入方法依賴的package包/類
/**
* Tests (=(decode (encode T)) T)
*/
public void testEncodeUsageType() {
EnumSet<UsageType> c = EnumSet.noneOf(UsageType.class);
c.add (UsageType.SUPER_CLASS);
c.add (UsageType.SUPER_INTERFACE);
String s = DocumentUtil.encodeUsage("foo", c);
Set<UsageType> r = EnumSet.noneOf(UsageType.class);
DocumentUtil.decodeUsage(s,r);
assertEquals(c.size(), r.size());
assertTrue(r.containsAll(c));
c.clear();
c.add (UsageType.TYPE_REFERENCE);
s = DocumentUtil.encodeUsage("foo", c);
r = EnumSet.noneOf(UsageType.class);
DocumentUtil.decodeUsage(s,r);
assertEquals(c.size(), r.size());
assertTrue(r.containsAll(c));
c.clear();
c.add (UsageType.SUPER_CLASS);
c.add (UsageType.TYPE_REFERENCE);
c.add (UsageType.FIELD_REFERENCE);
s = DocumentUtil.encodeUsage("foo", c);
r = EnumSet.noneOf(UsageType.class);
DocumentUtil.decodeUsage(s,r);
assertEquals(c.size(), r.size());
assertTrue(r.containsAll(c));
c.clear();
c.add (UsageType.SUPER_CLASS);
c.add (UsageType.METHOD_REFERENCE);
s = DocumentUtil.encodeUsage("foo", c);
r = EnumSet.noneOf(UsageType.class);
DocumentUtil.decodeUsage(s,r);
assertEquals(c.size(), r.size());
assertTrue(r.containsAll(c));
c.clear();
c.allOf(UsageType.class);
s = DocumentUtil.encodeUsage("foo", c);
r = EnumSet.noneOf(UsageType.class);
DocumentUtil.decodeUsage(s,r);
assertEquals(c.size(), r.size());
assertTrue(r.containsAll(c));
c.clear();
c.add (UsageType.SUPER_INTERFACE);
c.add (UsageType.METHOD_REFERENCE);
s = DocumentUtil.encodeUsage("foo", c);
r = EnumSet.noneOf(UsageType.class);
DocumentUtil.decodeUsage(s,r);
assertEquals(c.size(), r.size());
assertTrue(r.containsAll(c));
c.clear();
}