LightWeightLinkedSet extends LightWeightHashSet<T> { @Override public List<T> pollAll() { List<T> retList = new ArrayList<>(size); while (head != null) { retList.add(head.element); head = head.after; } this.clear(); return retList; } LightWeightLinkedSet(int initCapacity, float maxLoadFactor,
      float minLoadFactor);  LightWeightLinkedSet(); T pollFirst(); @Override List<T> pollN(int n); @Override List<T> pollAll(); @Override @SuppressWarnings("unchecked") U[] toArray(U[] a); @Override Iterator<T> iterator(); @Override void clear();  }
@Test public void testPollAll() { LOG.info("Test poll all"); for (Integer i : list) { assertTrue(set.add(i)); } while (set.pollFirst() != null) { ; } assertEquals(0, set.size()); assertTrue(set.isEmpty()); for (int i = 0; i < NUM; i++) { assertFalse(set.contains(list.get(i))); } Iterator<Integer> iter = set.iterator(); assertFalse(iter.hasNext()); LOG.info("Test poll all - DONE"); }