src/main/java/io/reactivex/Observable.java
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Single<List<T>> toList(final int capacityHint) {
        ObjectHelper.verifyPositive(capacityHint, "capacityHint");
        return RxJavaPlugins.onAssembly(new ObservableToListSingle<T, List<T>>(this, capacityHint));
    }
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Single<List<T>> toList(final int capacityHint) {
        ObjectHelper.verifyPositive(capacityHint, "capacityHint");
        return RxJavaPlugins.onAssembly(new ObservableToListSingle<T, List<T>>(this, capacityHint));
    }
Returns a Single that emits a single item, a list composed of all the items emitted by the
finite source ObservableSource.
<p>
<img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toList.2.png" alt="">
<p>
Normally, an ObservableSource that returns multiple items will do so by invoking its {@link Observer}'s
{@link Observer#onNext onNext} method for each such item. You can change this behavior, instructing the
ObservableSource to compose a list of all of these items and then to invoke the Observer's {@code onNext}
function once, passing it the entire list, by calling the ObservableSource's {@code toList} method prior to
calling its {@link #subscribe} method.
<p>
Note that this operator requires the upstream to signal {@code onComplete} for the accumulated list to
be emitted. Sources that are infinite and never complete will never emit anything through this
operator and an infinite source may lead to a fatal {@code OutOfMemoryError}.
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code toList} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>

@param capacityHint
the number of elements expected from the current Observable
@return a Single that emits a single item: a List containing all of the items emitted by the source
ObservableSource
@see <a href="http://reactivex.io/documentation/operators/to.html">ReactiveX operators documentation: To</a>