### Question:
PersistentTreeSet extends AbstractRedBlackTree<E, Node<E>, PersistentTreeSet<E>> implements PersistentSet<E> { @Override public Spliterator<E> spliterator() { if (root != null) { return new ElementSpliterator<E>(root, size, comparator); } else { return emptySpliterator(); } } private  PersistentTreeSet(); private  PersistentTreeSet(Comparator<? super E> comparator); private  PersistentTreeSet(Comparator<? super E> comparator, Node<E> root, int size); @SuppressWarnings("unchecked") static PersistentTreeSet<E> empty(); static PersistentTreeSet<E> empty(Comparator<? super E> comparator); static PersistentTreeSet<E> of(E... elements); static PersistentTreeSet<E> of(Comparator<? super E> comparator, E... elements); int size(); @Override boolean contains(Object key); @Override Set<E> asSet(); @Override PersistentTreeSet<E> conj(E value); @Override PersistentTreeSet<E> conjAll(Collection<? extends E> coll); @Override PersistentTreeSet<E> disj(Object keyObj); @Override MutableSet<E> toMutableSet(); @SuppressWarnings("unchecked") Iterator<E> iterator(); @Override Spliterator<E> spliterator(); String toString();  }### Answer:
@Test public void reduce_partially_consumed_spliterator() { Spliterator<Integer> spliterator = NUM_SET.spliterator(); assertThat(spliterator.tryAdvance(n -> assertThat(n).isEqualTo(1))).isEqualTo(true); assertThat(spliterator.tryAdvance(n -> assertThat(n).isEqualTo(2))).isEqualTo(true); assertThat(StreamSupport.stream(spliterator, false).reduce(Integer::sum).get()).isEqualTo(NUM_SET_SUM - 2 - 1); }