### Question:
SimpleHashSet implements Iterable<E> { @Override public Iterator<E> iterator() { return new Iterator<E>() { private int position; private final int expectedModCount = modCount; { position = -1; position = findNextNotNullElement(); } private int findNextNotNullElement() { int result = -1; for (int i = position + 1; i < mainStorage.length; i++) { if (mainStorage[i] != null) { result = i; break; } } return result; } @Override public boolean hasNext() { return (this.position != -1); } @Override public E next() { if (this.expectedModCount != modCount) { throw new ConcurrentModificationException(); } if (!hasNext()) { throw new NoSuchElementException(); } E result = (E) mainStorage[this.position]; this.position = findNextNotNullElement(); return result; } }; } SimpleHashSet();  SimpleHashSet(int size); int getSize(); boolean add(E element); boolean contains(E element); boolean remove(E element); @Override Iterator<E> iterator();  }### Answer:
@Test(expected = NoSuchElementException.class) public void ifNoElementThenNoSuchElementException() { SimpleHashSet<Integer> testSet = new SimpleHashSet<>(10); Iterator<Integer> testIterator = testSet.iterator(); assertThat(testIterator.hasNext(), is(false)); testIterator.next(); }