@Test public void testAddAll() throws Exception { Set<Integer> integersToCheck = Sets.newHashSet(); fillSet(10, integersToCheck); assertFalse("Set should be empty and so integers to check should not be a subset.", set.containsAll(integersToCheck)); assertTrue("The set should have changed as a result of add all.", set.addAll(integersToCheck)); assertFalse("The set should not have changed as a result of add all a second time.", set.addAll(integersToCheck)); assertTrue("The sets should now be equivalent.", set.containsAll(integersToCheck)); assertTrue("The sets should now be equivalent.", integersToCheck.containsAll(set)); }
@Override public boolean addAll(Collection<? extends E> c) { checkNotNull(c, "The collection to be added cannot be null."); boolean changed = false; for (Object item : c) { changed = items.add(serializer.encode(item)) || changed; } return changed; }
PersistentSet implements Set<E> { @Override public boolean addAll(Collection<? extends E> c) { checkNotNull(c, "The collection to be added cannot be null."); boolean changed = false; for (Object item : c) { changed = items.add(serializer.encode(item)) || changed; } return changed; } }
PersistentSet implements Set<E> { @Override public boolean addAll(Collection<? extends E> c) { checkNotNull(c, "The collection to be added cannot be null."); boolean changed = false; for (Object item : c) { changed = items.add(serializer.encode(item)) || changed; } return changed; } PersistentSet(org.onosproject.store.service.Serializer serializer, DB database, String name); }
PersistentSet implements Set<E> { @Override public boolean addAll(Collection<? extends E> c) { checkNotNull(c, "The collection to be added cannot be null."); boolean changed = false; for (Object item : c) { changed = items.add(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 addAll(Collection<? extends E> c) { checkNotNull(c, "The collection to be added cannot be null."); boolean changed = false; for (Object item : c) { changed = items.add(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();  }