src/main/java/io/reactivex/Observable.java
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Observable<T> sorted(Comparator<? super T> sortFunction) {
        ObjectHelper.requireNonNull(sortFunction, "sortFunction is null");
        return toList().toObservable().map(Functions.listSorter(sortFunction)).flatMapIterable(Functions.<List<T>>identity());
    }
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Observable<T> sorted(Comparator<? super T> sortFunction) {
        ObjectHelper.requireNonNull(sortFunction, "sortFunction is null");
        return toList().toObservable().map(Functions.listSorter(sortFunction)).flatMapIterable(Functions.<List<T>>identity());
    }
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > sorted ( Comparator < ? super T > sortFunction ) { ObjectHelper . requireNonNull ( sortFunction , "sortFunction is null" ) ; return toList ( ) . toObservable ( ) . map ( Functions . listSorter ( sortFunction ) ) . flatMapIterable ( Functions . < List < T > > identity ( ) ) ; }
Returns an Observable that emits the events emitted by source ObservableSource, in a
sorted order based on a specified comparison function.

<p>Note that calling {@code sorted} with long, non-terminating or infinite sources
might cause {@link OutOfMemoryError}

<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code sorted} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>

@param sortFunction
a function that compares two items emitted by the source ObservableSource and returns an Integer
that indicates their sort order
@return an Observable that emits the items emitted by the source ObservableSource in sorted order
Returns an Observable that emits the events emitted by source ObservableSource in a sorted order based on a specified comparison function .