本文整理匯總了Java中gnu.trove.set.TIntSet.clear方法的典型用法代碼示例。如果您正苦於以下問題:Java TIntSet.clear方法的具體用法?Java TIntSet.clear怎麽用?Java TIntSet.clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gnu.trove.set.TIntSet
的用法示例。
在下文中一共展示了TIntSet.clear方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testIsEmpty
import gnu.trove.set.TIntSet; //導入方法依賴的package包/類
public void testIsEmpty() throws Exception {
TIntSet s = new TIntOffheapHashSet();
assertTrue("new set wasn't empty", s.isEmpty());
s.add(1);
assertTrue("set with element reports empty", !s.isEmpty());
s.clear();
assertTrue("cleared set reports not-empty", s.isEmpty());
}
示例2: testClear
import gnu.trove.set.TIntSet; //導入方法依賴的package包/類
public void testClear() throws Exception {
TIntSet set = new TIntOffheapHashSet();
set.addAll(new int[]{1, 2, 3});
assertEquals("size was not 3", 3, set.size());
set.clear();
assertEquals("initial size was not 0", 0, set.size());
}
示例3: testIsEmpty
import gnu.trove.set.TIntSet; //導入方法依賴的package包/類
public void testIsEmpty() throws Exception {
TIntSet s = new TIntHashSet();
assertTrue("new set wasn't empty", s.isEmpty());
s.add(1);
assertTrue("set with element reports empty", !s.isEmpty());
s.clear();
assertTrue("cleared set reports not-empty", s.isEmpty());
}
示例4: testClear
import gnu.trove.set.TIntSet; //導入方法依賴的package包/類
public void testClear() throws Exception {
TIntSet set = new TIntHashSet();
set.addAll(new int[]{1, 2, 3});
assertEquals("size was not 3", 3, set.size());
set.clear();
assertEquals("initial size was not 0", 0, set.size());
}