Buggy code:
@ Override public < R > StreamEx < R > flatMap ( Function < ? super T , ? extends Stream < ? extends R > > mapper ) { } @ Override public < R > StreamEx < R > map ( Function < ? super T , ? extends R > mapper ) { } @ Override public IntStreamEx mapToInt ( ToIntFunction < ? super T > mapper ) { } @ Override public LongStreamEx mapToLong ( ToLongFunction < ? super T > mapper ) { } @ Override public DoubleStreamEx mapToDouble ( ToDoubleFunction < ? super T > mapper ) { } @ Override public IntStreamEx flatMapToInt ( Function < ? super T , ? extends IntStream > mapper ) { } @ Override public LongStreamEx flatMapToLong ( Function < ? super T , ? extends LongStream > mapper ) { } @ Override public DoubleStreamEx flatMapToDouble ( Function < ? super T , ? extends DoubleStream > mapper ) { } @ Override public S distinct ( ) { } public S distinct ( Function < ? super T , ? > keyExtractor ) { } @ Override public S sorted ( ) { } @ Override public S sorted ( Comparator < ? super T > comparator ) { } @ Override public S peek ( Consumer < ? super T > action ) { } @ Override public S limit ( long maxSize ) { } @ Override public S skip ( long n ) { } @ Override public void forEach ( Consumer < ? super T > action ) { } @ Override public void forEachOrdered ( Consumer < ? super T > action ) { } @ Override public Object [ ] toArray ( ) { } @ Override public < A > A [ ] toArray ( IntFunction < A [ ] > generator ) { } @ Override public T reduce ( T identity , BinaryOperator < T > accumulator ) { } @ Override public Optional < T > reduce ( BinaryOperator < T > accumulator ) { } @ Override public < U > U reduce ( U identity , BiFunction < U , ? super T , U > accumulator , BinaryOperator < U > combiner ) { } @ Override public < R > R collect ( Supplier < R > supplier , BiConsumer < R , ? super T > accumulator , BiConsumer < R , R > combiner ) { } @ Override public < R , A > R collect ( Collector < ? super T , A , R > collector ) { if ( collector instanceof CancellableCollector ) { CancellableCollector < ? super T , A , R > c = ( ( CancellableCollector < ? super T , A , R > ) ( collector ) ) ; BiConsumer < A , ? super T > acc = c . accumulator ( ) ; Predicate < A > finished = c . finished ( ) ; BinaryOperator < A > combiner = c . combiner ( ) ; Spliterator < T > spliterator = stream . spliterator ( ) ; if ( ! ( isParallel ( ) ) ) { A a = c . supplier ( ) . get ( ) ; if ( ! ( finished . test ( a ) ) ) { try { spliterator . forEachRemaining ( ( e ) -> { acc . accept ( a , e ) ; if ( finished . test ( a ) ) throw new CancelException ( ) ; } ) ; } catch ( CancelException ex ) { } } return c . finisher ( ) . apply ( a ) ; } Spliterator < A > spltr ; if ( ( ! ( spliterator . hasCharacteristics ( Spliterator . ORDERED ) ) ) || ( c . characteristics ( ) . contains ( Collector . Characteristics . UNORDERED ) ) ) { spltr = new UnorderedCancellableSpliterator ( spliterator , c . supplier ( ) , acc , combiner , finished ) ; } else { <START_BUG> spltr = new OrderedCancellableSpliterator2 ( spliterator , c . supplier ( ) , acc , combiner , finished ) ; <END_BUG> } return c . finisher ( ) . apply ( strategy ( ) . newStreamEx ( StreamSupport . stream ( spltr , true ) ) . findFirst ( ) . get ( ) ) ; } return rawCollect ( collector ) ; } public < R , A > R collectOld ( Collector < ? super T , A , R > collector ) { } @ Override public Optional < T > min ( Comparator < ? super T > comparator ) { } @ Override public Optional < T > max ( Comparator < ? super T > comparator ) { } @ Override public long count ( ) { } @ Override public boolean anyMatch ( Predicate < ? super T > predicate ) { } @ Override public boolean allMatch ( Predicate < ? super T > predicate ) { } @ Override public boolean noneMatch ( Predicate < ? super T > predicate ) { } @ Override public Optional < T > findFirst ( ) { } @ Override public Optional < T > findAny ( ) { } public OptionalLong indexOf ( T element ) { } public OptionalLong indexOf ( Predicate < ? super T > predicate ) { } public < R > StreamEx < R > flatCollection ( Function < ? super T , ? extends Collection < ? extends R > > mapper ) { } public S remove ( Predicate < ? super T > predicate ) { } public S nonNull ( ) { } public Optional < T > findAny ( Predicate < ? super T > predicate ) { }

Fix:
spltr = new OrderedCancellableSpliterator3 ( spliterator , c . supplier ( ) , acc , combiner , finished ) ;