LazySet implements Set<E> { @Override public final Iterator<E> iterator() { return delegate.iterator(); }  @Override final int size(); @Override final boolean isEmpty(); @Override final boolean contains(Object o); @Override final Iterator<E> iterator(); @Override final Object[] toArray(); @Override final T[] toArray(T[] a); @Override final boolean add(E e); @Override final boolean remove(Object o); @Override final boolean containsAll(Collection<?> c); @Override final boolean addAll(Collection<? extends E> c); @Override final boolean retainAll(Collection<?> c); @Override final boolean removeAll(Collection<?> c); @Override final void clear(); @Override final int hashCode(); @Override final boolean equals(Object obj); static LazySet<E> newHashSet();  }
@Test public void requireThatSingletonIteratorNextThrowsIfInvokedMoreThanOnce() { LazySet<String> set = newSingletonSet("foo"); Iterator<String> it = set.iterator(); it.next(); try { it.next(); fail(); } catch (NoSuchElementException e) { } try { it.next(); fail(); } catch (NoSuchElementException e) { } }