SingletonSpliterator implements Spliterator<T> { @Override public long estimateSize() { return consumed ? 0 : 1; } 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 testEstimateSize() { printTestName(); assertEquals(1, instance.estimateSize()); instance.tryAdvance(DO_NOTHING); assertEquals(0, instance.estimateSize()); instance.tryAdvance(DO_NOTHING); assertEquals(0, instance.estimateSize()); }