src/main/java/io/reactivex/Observable.java
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <R> Observable<R> flatMap(Function<? super T, ? extends ObservableSource<? extends R>> mapper,
            boolean delayErrors, int maxConcurrency, int bufferSize) {
        ObjectHelper.requireNonNull(mapper, "mapper is null");
        ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency");
        ObjectHelper.verifyPositive(bufferSize, "bufferSize");
        if (this instanceof ScalarCallable) {
            @SuppressWarnings("unchecked")
            T v = ((ScalarCallable<T>)this).call();
            if (v == null) {
                return empty();
            }
            return ObservableScalarXMap.scalarXMap(v, mapper);
        }
        return RxJavaPlugins.onAssembly(new ObservableFlatMap<T, R>(this, mapper, delayErrors, maxConcurrency, bufferSize));
    }
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <R> Observable<R> flatMap(Function<? super T, ? extends ObservableSource<? extends R>> mapper,
            boolean delayErrors, int maxConcurrency, int bufferSize) {
        ObjectHelper.requireNonNull(mapper, "mapper is null");
        ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency");
        ObjectHelper.verifyPositive(bufferSize, "bufferSize");
        if (this instanceof ScalarCallable) {
            @SuppressWarnings("unchecked")
            T v = ((ScalarCallable<T>)this).call();
            if (v == null) {
                return empty();
            }
            return ObservableScalarXMap.scalarXMap(v, mapper);
        }
        return RxJavaPlugins.onAssembly(new ObservableFlatMap<T, R>(this, mapper, delayErrors, maxConcurrency, bufferSize));
    }
Returns an Observable that emits items based on applying a function that you supply to each item emitted
by the source ObservableSource, where that function returns an ObservableSource, and then merging those resulting
ObservableSources and emitting the results of this merger, while limiting the maximum number of concurrent
subscriptions to these ObservableSources.
<p>
<img width="640" height="441" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/flatMapMaxConcurrency.o.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code flatMap} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>

@param <R> the value type of the inner ObservableSources and the output type
@param mapper
a function that, when applied to an item emitted by the source ObservableSource, returns an
ObservableSource
@param maxConcurrency
the maximum number of ObservableSources that may be subscribed to concurrently
@param delayErrors
if true, exceptions from the current Observable and all inner ObservableSources are delayed until all of them terminate
if false, the first one signalling an exception will terminate the whole sequence immediately
@param bufferSize
the number of elements to prefetch from each inner ObservableSource
@return an Observable that emits the result of applying the transformation function to each item emitted
by the source ObservableSource and merging the results of the ObservableSources obtained from this
transformation
@see <a href="http://reactivex.io/documentation/operators/flatmap.html">ReactiveX operators documentation: FlatMap</a>
@since 2.0