SingletonPrimitiveIteratorOfLong implements PrimitiveIterator.OfLong { @Override public Long next() { if (!hasNext) { throw new NoSuchElementException(); } return nextLong(); } SingletonPrimitiveIteratorOfLong(long element); @Override boolean hasNext(); @Override long nextLong(); @Override Long next(); @Override void remove(); @Override void forEachRemaining(LongConsumer action);  }
@Test void nextIntAfterNext() { instance.next(); assertThrows(NoSuchElementException.class, instance::nextLong); }
@Test void next() { assertEquals(ELEMENT, instance.next()); }
@Test void nextAfterNext() { instance.next(); assertThrows(NoSuchElementException.class, instance::next); }