void () { final AtomicInteger count = new AtomicInteger(0); JBIterator<Integer> it = new JBIterator<>() { @Override protected Integer nextImpl() { return count.get() < 0 ? stop() : count.incrementAndGet() < 10 ? skip() : (Integer)count.addAndGet(-count.get() - 1); } }; assertEquals(JBIterable.of(-1).toList(), JBIterable.once(it).toList()); }