/** * Adds all elements within a given collection to this set. * * @param collect the input collection. * @return true if the add succeeds. * @throws DataAccessLayerException in case of data access failure. */ public boolean addAll(final Collection<? extends E> collect) throws DataAccessLayerException { if (collect == null || collect.isEmpty()) { return false; } boolean changed = false; for (final E obj : collect) { changed = changed | add(obj); } return changed; }
/** * Adds all elements within a given collection to this set. * * @param collect the input collection. * @return true if the add succeeds. * @throws DataAccessLayerException in case of data access failure. */ public boolean addAll(final Collection<? extends E> collect) throws DataAccessLayerException { if (collect == null || collect.isEmpty()) { return false; } boolean changed = false; for (final E obj : collect) { changed = changed | add(obj); } return changed; }
@Before public void reset() throws DataAccessLayerException { CLASS_UNDER_TEST.clear(); for (Iterator<String> iter = TESTDATA1.iterator(); iter.hasNext();) { CLASS_UNDER_TEST.add(iter.next()); } }
@Test public void addTest() throws DataAccessLayerException { CLASS_UNDER_TEST.clear(); assertTrue(CLASS_UNDER_TEST.isEmpty()); for (String key : TESTDATA1) { assertTrue(CLASS_UNDER_TEST.add(key)); } assertTrue(CLASS_UNDER_TEST.size() == TESTDATA1.size()); assertTrue(CLASS_UNDER_TEST.containsAll(TESTDATA1)); }