SingletonPrimitiveIteratorOfLong implements PrimitiveIterator.OfLong { @Override public void forEachRemaining(LongConsumer action) { requireNonNull(action); if (hasNext) { action.accept(element); hasNext = false; } } SingletonPrimitiveIteratorOfLong(long element); @Override boolean hasNext(); @Override long nextLong(); @Override Long next(); @Override void remove(); @Override void forEachRemaining(LongConsumer action);  }
@Test void forEachRemainingIntConsumer() { instance.forEachRemaining((LongConsumer) i -> cnt.incrementAndGet()); assertEquals(1, cnt.get()); }
@Test void forEachRemainingConsumer() { instance.forEachRemaining((Consumer<Long>) i -> cnt.incrementAndGet()); assertEquals(1, cnt.get()); }