ArraySpliterator implements Spliterator<T> { @Override public Spliterator<T> trySplit() { final int lo = index; final int mid = (lo + size) >>> 1; if (lo >= mid) { return null; } else { index = mid; return new ArraySpliterator<>(array, lo, index, characteristics); } } ArraySpliterator(Object[] array, int additionalCharacteristics);   ArraySpliterator(Object[] array, int origin, int size, 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 testTrySplit() { Set<String> threadNames = new HashSet<>(); final Set<Integer> set = StreamSupport.stream(instance, true) .peek(i -> threadNames.add(Thread.currentThread().getName())) .collect(toSet()); assertEquals(expectedSet, set); }