本文整理汇总了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));
}