### Question:
LightWeightHashSet implements Collection<T> { public List<T> pollAll() { List<T> retList = new ArrayList<T>(size); for (int i = 0; i < entries.length; i++) { LinkedElement<T> current = entries[i]; while (current != null) { retList.add(current.element); current = current.next; } } this.clear(); return retList; } @SuppressWarnings("unchecked")  LightWeightHashSet(int initCapacity, float maxLoadFactor,
      float minLoadFactor);  LightWeightHashSet();  LightWeightHashSet(int minCapacity); @Override boolean isEmpty(); int getCapacity(); @Override int size(); @SuppressWarnings("unchecked") @Override boolean contains(final Object key); T getElement(final T key); @Override boolean addAll(Collection<? extends T> toAdd); @Override boolean add(final T element); @Override @SuppressWarnings("unchecked") boolean remove(final Object key); List<T> pollN(int n); List<T> pollAll(); @SuppressWarnings("unchecked") T[] pollToArray(T[] array); @Override Iterator<T> iterator(); @Override String toString(); void printDetails(final PrintStream out); @Override @SuppressWarnings("unchecked") void clear(); @Override Object[] toArray(); @Override @SuppressWarnings("unchecked") U[] toArray(U[] a); @Override boolean containsAll(Collection<?> c); @Override boolean removeAll(Collection<?> c); @Override boolean retainAll(Collection<?> c);  }### Answer:
@Test public void testPollAll() { LOG.info("Test poll all"); for (Integer i : list) { assertTrue(set.add(i)); } List<Integer> poll = set.pollAll(); assertEquals(0, set.size()); assertTrue(set.isEmpty()); for (int i = 0; i < NUM; i++) { assertFalse(set.contains(list.get(i))); } for (Integer i : poll) { assertTrue(list.contains(i)); } Iterator<Integer> iter = set.iterator(); assertFalse(iter.hasNext()); LOG.info("Test poll all - DONE"); }