src/main/java/io/reactivex/parallel/ParallelFlowable.java
@CheckReturnValue
    @NonNull
    public final Flowable<List<T>> toSortedList(@NonNull Comparator<? super T> comparator, int capacityHint) {
        ObjectHelper.requireNonNull(comparator, "comparator is null");
        ObjectHelper.verifyPositive(capacityHint, "capacityHint");

        int ch = capacityHint / parallelism() + 1;
        ParallelFlowable<List<T>> railReduced = reduce(Functions.<T>createArrayList(ch), ListAddBiConsumer.<T>instance());
        ParallelFlowable<List<T>> railSorted = railReduced.map(new SorterFunction<T>(comparator));

        Flowable<List<T>> merged = railSorted.reduce(new MergerBiFunction<T>(comparator));

        return RxJavaPlugins.onAssembly(merged);
    }
@CheckReturnValue
    @NonNull
    public final Flowable<List<T>> toSortedList(@NonNull Comparator<? super T> comparator, int capacityHint) {
        ObjectHelper.requireNonNull(comparator, "comparator is null");
        ObjectHelper.verifyPositive(capacityHint, "capacityHint");

        int ch = capacityHint / parallelism() + 1;
        ParallelFlowable<List<T>> railReduced = reduce(Functions.<T>createArrayList(ch), ListAddBiConsumer.<T>instance());
        ParallelFlowable<List<T>> railSorted = railReduced.map(new SorterFunction<T>(comparator));

        Flowable<List<T>> merged = railSorted.reduce(new MergerBiFunction<T>(comparator));

        return RxJavaPlugins.onAssembly(merged);
    }
@ CheckReturnValue @ NonNull public final Flowable < List < T > > toSortedList ( @ NonNull Comparator < ? super T > comparator , int capacityHint ) { ObjectHelper . requireNonNull ( comparator , "comparator is null" ) ; ObjectHelper . verifyPositive ( capacityHint , "capacityHint" ) ; int ch = capacityHint / parallelism ( ) + 1 ; ParallelFlowable < List < T > > railReduced = reduce ( Functions . < T > createArrayList ( ch ) , ListAddBiConsumer . < T > instance ( ) ) ; ParallelFlowable < List < T > > railSorted = railReduced . map ( new SorterFunction < T > ( comparator ) ) ; Flowable < List < T > > merged = railSorted . reduce ( new MergerBiFunction < T > ( comparator ) ) ; return RxJavaPlugins . onAssembly ( merged ) ; }
Sorts the 'rails' according to the comparator and returns a full sorted list as a Publisher.
<p>
This operator requires a finite source ParallelFlowable.

@param comparator the comparator to compare elements
@param capacityHint the expected number of total elements
@return the new Flowable instance
Sorts the rails according to the comparator and returns a full sorted list as a Publisher . <p > This operator requires a finite source ParallelFlowable .