本文整理匯總了Java中java.util.concurrent.CopyOnWriteArraySet.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java CopyOnWriteArraySet.remove方法的具體用法?Java CopyOnWriteArraySet.remove怎麽用?Java CopyOnWriteArraySet.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.concurrent.CopyOnWriteArraySet
的用法示例。
在下文中一共展示了CopyOnWriteArraySet.remove方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testEquals
import java.util.concurrent.CopyOnWriteArraySet; //導入方法依賴的package包/類
/**
* Sets with equal elements are equal
*/
public void testEquals() {
CopyOnWriteArraySet a = populatedSet(3);
CopyOnWriteArraySet b = populatedSet(3);
assertTrue(a.equals(b));
assertTrue(b.equals(a));
assertTrue(a.containsAll(b));
assertTrue(b.containsAll(a));
assertEquals(a.hashCode(), b.hashCode());
assertEquals(a.size(), b.size());
a.add(m1);
assertFalse(a.equals(b));
assertFalse(b.equals(a));
assertTrue(a.containsAll(b));
assertFalse(b.containsAll(a));
b.add(m1);
assertTrue(a.equals(b));
assertTrue(b.equals(a));
assertTrue(a.containsAll(b));
assertTrue(b.containsAll(a));
assertEquals(a.hashCode(), b.hashCode());
Object x = a.iterator().next();
a.remove(x);
assertFalse(a.equals(b));
assertFalse(b.equals(a));
assertFalse(a.containsAll(b));
assertTrue(b.containsAll(a));
a.add(x);
assertTrue(a.equals(b));
assertTrue(b.equals(a));
assertTrue(a.containsAll(b));
assertTrue(b.containsAll(a));
assertEquals(a.hashCode(), b.hashCode());
assertEquals(a.size(), b.size());
CopyOnWriteArraySet empty1 = new CopyOnWriteArraySet(Arrays.asList());
CopyOnWriteArraySet empty2 = new CopyOnWriteArraySet(Arrays.asList());
assertTrue(empty1.equals(empty1));
assertTrue(empty1.equals(empty2));
assertFalse(empty1.equals(a));
assertFalse(a.equals(empty1));
assertFalse(a.equals(null));
}