src/main/java/io/reactivex/Flowable.java
@CheckReturnValue
    @BackpressureSupport(BackpressureKind.UNBOUNDED_IN)
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Single<List<T>> toList(final int capacityHint) {
        ObjectHelper.verifyPositive(capacityHint, "capacityHint");
        return RxJavaPlugins.onAssembly(new FlowableToListSingle<T, List<T>>(this, Functions.<T>createArrayList(capacityHint)));
    }
@CheckReturnValue
    @BackpressureSupport(BackpressureKind.UNBOUNDED_IN)
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Single<List<T>> toList(final int capacityHint) {
        ObjectHelper.verifyPositive(capacityHint, "capacityHint");
        return RxJavaPlugins.onAssembly(new FlowableToListSingle<T, List<T>>(this, Functions.<T>createArrayList(capacityHint)));
    }
Returns a Single that emits a single item, a list composed of all the items emitted by the
finite source Publisher.
<p>
<img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toList.png" alt="">
<p>
Normally, a Publisher that returns multiple items will do so by invoking its {@link Subscriber}'s
{@link Subscriber#onNext onNext} method for each such item. You can change this behavior, instructing the
Publisher to compose a list of all of these items and then to invoke the Subscriber's {@code onNext}
function once, passing it the entire list, by calling the Publisher'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>Backpressure:</b></dt>
<dd>The operator honors backpressure from downstream and consumes the source {@code Publisher} in an
unbounded manner (i.e., without applying backpressure to it).</dd>
<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 Flowable
@return a Flowable that emits a single item: a List containing all of the items emitted by the source
Publisher
@see <a href="http://reactivex.io/documentation/operators/to.html">ReactiveX operators documentation: To</a>