@Test public void testRemoveAll() throws Exception { Set<Integer> removeSet = Sets.newHashSet(); fillSet(10, set); Set<Integer> duplicateSet = Sets.newHashSet(set); assertFalse("No elements should change.", set.removeAll(removeSet)); assertEquals("Set should not have diverged from the duplicate.", duplicateSet, set); fillSet(5, removeSet); assertTrue("Elements should have been removed.", set.removeAll(removeSet)); assertNotEquals("Duplicate set should no longer be equivalent.", duplicateSet, set); assertEquals("Five elements should have been removed from set.", 5, set.size()); for (Integer item : removeSet) { assertFalse("No element of remove set should remain.", set.contains(item)); } }
@Override public boolean removeAll(Collection<?> c) { boolean changed = false; for (Object item : c) { changed = items.remove(serializer.encode(item)) || changed; } return changed; }
PersistentSet implements Set<E> { @Override public boolean removeAll(Collection<?> c) { boolean changed = false; for (Object item : c) { changed = items.remove(serializer.encode(item)) || changed; } return changed; } }
PersistentSet implements Set<E> { @Override public boolean removeAll(Collection<?> c) { boolean changed = false; for (Object item : c) { changed = items.remove(serializer.encode(item)) || changed; } return changed; } PersistentSet(org.onosproject.store.service.Serializer serializer, DB database, String name); }
PersistentSet implements Set<E> { @Override public boolean removeAll(Collection<?> c) { boolean changed = false; for (Object item : c) { changed = items.remove(serializer.encode(item)) || changed; } return changed; } PersistentSet(org.onosproject.store.service.Serializer serializer, DB database, String name); void readInto(Set<E> items); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override Iterator<E> iterator(); @Override Object[] toArray(); @Override T[] toArray(T[] a); @Override boolean add(E item); @Override boolean remove(Object o); @Override boolean containsAll(Collection<?> c); @Override boolean addAll(Collection<? extends E> c); @Override boolean retainAll(Collection<?> c); @Override boolean removeAll(Collection<?> c); @Override void clear(); @Override boolean equals(Object set); @Override int hashCode(); }
PersistentSet implements Set<E> { @Override public boolean removeAll(Collection<?> c) { boolean changed = false; for (Object item : c) { changed = items.remove(serializer.encode(item)) || changed; } return changed; } PersistentSet(org.onosproject.store.service.Serializer serializer, DB database, String name); void readInto(Set<E> items); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override Iterator<E> iterator(); @Override Object[] toArray(); @Override T[] toArray(T[] a); @Override boolean add(E item); @Override boolean remove(Object o); @Override boolean containsAll(Collection<?> c); @Override boolean addAll(Collection<? extends E> c); @Override boolean retainAll(Collection<?> c); @Override boolean removeAll(Collection<?> c); @Override void clear(); @Override boolean equals(Object set); @Override int hashCode();  }