src/main/java/io/reactivex/Observable.java
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Observable<T> sorted() {
        return toList().toObservable().map(Functions.listSorter(Functions.<T>naturalComparator())).flatMapIterable(Functions.<List<T>>identity());
    }
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Observable<T> sorted() {
        return toList().toObservable().map(Functions.listSorter(Functions.<T>naturalComparator())).flatMapIterable(Functions.<List<T>>identity());
    }
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > sorted ( ) { return toList ( ) . toObservable ( ) . map ( Functions . listSorter ( Functions . < T > naturalComparator ( ) ) ) . flatMapIterable ( Functions . < List < T > > identity ( ) ) ; }
Returns an Observable that emits the events emitted by source ObservableSource, in a
sorted order. Each item emitted by the ObservableSource must implement {@link Comparable} with respect to all
other items in the sequence.
<p>
<img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/sorted.png" alt="">
<p>
If any item emitted by this Observable does not implement {@link Comparable} with respect to
all other items emitted by this Observable, no items will be emitted and the
sequence is terminated with a {@link ClassCastException}.

<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>
@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 . Each item emitted by the ObservableSource must implement { @link Comparable } with respect to all other items in the sequence . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / sorted . png alt = > <p > If any item emitted by this Observable does not implement { @link Comparable } with respect to all other items emitted by this Observable no items will be emitted and the sequence is terminated with a { @link ClassCastException } .