SingletonSpliterator implements Spliterator<T> { @Override public boolean tryAdvance(Consumer<? super T> action) { requireNonNull(action); if (!consumed) { @SuppressWarnings("unchecked") final T e = (T) item; action.accept(e); consumed = true; return true; } return false; } SingletonSpliterator(Object item, int additionalCharacteristics); @Override Spliterator<T> trySplit(); @SuppressWarnings("unchecked") @Override void forEachRemaining(Consumer<? super T> action); @Override boolean tryAdvance(Consumer<? super T> action); @Override long estimateSize(); @Override int characteristics(); @Override Comparator<? super T> getComparator();  }
@Test void testTryAdvance() { printTestName(); assertTrue(instance.tryAdvance(DO_NOTHING)); assertFalse(instance.tryAdvance(DO_NOTHING)); }