### Question:
LightWeightLinkedSet extends LightWeightHashSet<T> { public Iterator<T> getBookmark() { LinkedSetIterator toRet = new LinkedSetIterator(); toRet.next = this.bookmark.next; this.bookmark = toRet; return toRet; } 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(); Iterator<T> getBookmark(); void resetBookmark();  }### Answer:
@Test(timeout=60000) public void testGetBookmarkReturnsBookmarkIterator() { LOG.info("Test getBookmark returns proper iterator"); assertTrue(set.addAll(list)); Iterator<Integer> bookmark = set.getBookmark(); assertEquals(bookmark.next(), list.get(0)); final int numAdvance = list.size()/2; for(int i=1; i<numAdvance; i++) { bookmark.next(); } Iterator<Integer> bookmark2 = set.getBookmark(); assertEquals(bookmark2.next(), list.get(numAdvance)); }
@Test(timeout=60000) public void testBookmarkAdvancesOnRemoveOfSameElement() { LOG.info("Test that the bookmark advances if we remove its element."); assertTrue(set.add(list.get(0))); assertTrue(set.add(list.get(1))); assertTrue(set.add(list.get(2))); Iterator<Integer> it = set.getBookmark(); assertEquals(it.next(), list.get(0)); set.remove(list.get(1)); it = set.getBookmark(); assertEquals(it.next(), list.get(2)); }
@Test(timeout=60000) public void testBookmarkSetToHeadOnAddToEmpty() { LOG.info("Test bookmark is set after adding to previously empty set."); Iterator<Integer> it = set.getBookmark(); assertFalse(it.hasNext()); set.add(list.get(0)); set.add(list.get(1)); it = set.getBookmark(); assertTrue(it.hasNext()); assertEquals(it.next(), list.get(0)); assertEquals(it.next(), list.get(1)); assertFalse(it.hasNext()); }