|
25 | 25 | import io.reactivex.internal.functions.*;
|
26 | 26 | import io.reactivex.internal.fuseable.ScalarCallable;
|
27 | 27 | import io.reactivex.internal.operators.flowable.*;
|
28 |
| -import io.reactivex.internal.operators.observable.ObservableFromPublisher; |
| 28 | +import io.reactivex.internal.operators.observable.*; |
29 | 29 | import io.reactivex.internal.schedulers.ImmediateThinScheduler;
|
30 | 30 | import io.reactivex.internal.subscribers.*;
|
31 | 31 | import io.reactivex.internal.util.*;
|
@@ -8266,6 +8266,49 @@ public final <U, R> Flowable<R> flatMap(Function<? super T, ? extends Publisher<
|
8266 | 8266 | return flatMap(mapper, combiner, false, maxConcurrency, bufferSize());
|
8267 | 8267 | }
|
8268 | 8268 |
|
| 8269 | + /** |
| 8270 | + * Maps each element of the upstream Flowable into CompletableSources, subscribes to them and |
| 8271 | + * waits until the upstream and all CompletableSources complete. |
| 8272 | + * <dl> |
| 8273 | + * <dt><b>Backpressure:</b></dt> |
| 8274 | + * <dd>The operator consumes the upstream in an unbounded manner.</dd> |
| 8275 | + * <dt><b>Scheduler:</b></dt> |
| 8276 | + * <dd>{@code flatMapCompletable} does not operate by default on a particular {@link Scheduler}.</dd> |
| 8277 | + * </dl> |
| 8278 | + * @param mapper the function that received each source value and transforms them into CompletableSources. |
| 8279 | + * @return the new Completable instance |
| 8280 | + */ |
| 8281 | + @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) |
| 8282 | + @SchedulerSupport(SchedulerSupport.NONE) |
| 8283 | + public final Completable flatMapCompletable(Function<? super T, ? extends CompletableSource> mapper) { |
| 8284 | + return flatMapCompletable(mapper, false, Integer.MAX_VALUE); |
| 8285 | + } |
| 8286 | + |
| 8287 | + /** |
| 8288 | + * Maps each element of the upstream Flowable into CompletableSources, subscribes to them and |
| 8289 | + * waits until the upstream and all CompletableSources complete, optionally delaying all errors. |
| 8290 | + * <dl> |
| 8291 | + * <dt><b>Backpressure:</b></dt> |
| 8292 | + * <dd>If {@code maxConcurrency == Integer.MAX_VALUE} the operator consumes the upstream in an unbounded manner. |
| 8293 | + * Otherwise the operator expects the upstream to honor backpressure. If the upstream doesn't support backpressure |
| 8294 | + * the operator behaves as if {@code maxConcurrency == Integer.MAX_VALUE} was used.</dd> |
| 8295 | + * <dt><b>Scheduler:</b></dt> |
| 8296 | + * <dd>{@code flatMapCompletable} does not operate by default on a particular {@link Scheduler}.</dd> |
| 8297 | + * </dl> |
| 8298 | + * @param mapper the function that received each source value and transforms them into CompletableSources. |
| 8299 | + * @param delayErrors if true errors from the upstream and inner CompletableSources are delayed until each of them |
| 8300 | + * terminates. |
| 8301 | + * @param maxConcurrency the maximum number of active subscriptions to the CompletableSources. |
| 8302 | + * @return the new Completable instance |
| 8303 | + */ |
| 8304 | + @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) |
| 8305 | + @SchedulerSupport(SchedulerSupport.NONE) |
| 8306 | + public final Completable flatMapCompletable(Function<? super T, ? extends CompletableSource> mapper, boolean delayErrors, int maxConcurrency) { |
| 8307 | + ObjectHelper.requireNonNull(mapper, "mapper is null"); |
| 8308 | + ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); |
| 8309 | + return RxJavaPlugins.onAssembly(new FlowableFlatMapCompletableCompletable<T>(this, mapper, delayErrors, maxConcurrency)); |
| 8310 | + } |
| 8311 | + |
8269 | 8312 | /**
|
8270 | 8313 | * Returns a Flowable that merges each item emitted by the source Publisher with the values in an
|
8271 | 8314 | * Iterable corresponding to that item that is generated by a selector.
|
@@ -8405,6 +8448,96 @@ public final <U, V> Flowable<V> flatMapIterable(final Function<? super T, ? exte
|
8405 | 8448 | return flatMap(FlowableInternalHelper.flatMapIntoIterable(mapper), resultSelector, false, bufferSize(), prefetch);
|
8406 | 8449 | }
|
8407 | 8450 |
|
| 8451 | + /** |
| 8452 | + * Maps each element of the upstream Flowable into MaybeSources, subscribes to them and |
| 8453 | + * waits until the upstream and all MaybeSources complete. |
| 8454 | + * <dl> |
| 8455 | + * <dt><b>Backpressure:</b></dt> |
| 8456 | + * <dd>The operator consumes the upstream in an unbounded manner.</dd> |
| 8457 | + * <dt><b>Scheduler:</b></dt> |
| 8458 | + * <dd>{@code flatMapMaybe} does not operate by default on a particular {@link Scheduler}.</dd> |
| 8459 | + * </dl> |
| 8460 | + * @param <R> the result value type |
| 8461 | + * @param mapper the function that received each source value and transforms them into MaybeSources. |
| 8462 | + * @return the new Flowable instance |
| 8463 | + */ |
| 8464 | + @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) |
| 8465 | + @SchedulerSupport(SchedulerSupport.NONE) |
| 8466 | + public final <R> Flowable<R> flatMapMaybe(Function<? super T, ? extends MaybeSource<? extends R>> mapper) { |
| 8467 | + return flatMapMaybe(mapper, false, Integer.MAX_VALUE); |
| 8468 | + } |
| 8469 | + |
| 8470 | + /** |
| 8471 | + * Maps each element of the upstream Flowable into MaybeSources, subscribes to them and |
| 8472 | + * waits until the upstream and all MaybeSources complete, optionally delaying all errors. |
| 8473 | + * <dl> |
| 8474 | + * <dt><b>Backpressure:</b></dt> |
| 8475 | + * <dd>If {@code maxConcurrency == Integer.MAX_VALUE} the operator consumes the upstream in an unbounded manner. |
| 8476 | + * Otherwise the operator expects the upstream to honor backpressure. If the upstream doesn't support backpressure |
| 8477 | + * the operator behaves as if {@code maxConcurrency == Integer.MAX_VALUE} was used.</dd> |
| 8478 | + * <dt><b>Scheduler:</b></dt> |
| 8479 | + * <dd>{@code flatMapMaybe} does not operate by default on a particular {@link Scheduler}.</dd> |
| 8480 | + * </dl> |
| 8481 | + * @param <R> the result value type |
| 8482 | + * @param mapper the function that received each source value and transforms them into MaybeSources. |
| 8483 | + * @param delayErrors if true errors from the upstream and inner MaybeSources are delayed until each of them |
| 8484 | + * terminates. |
| 8485 | + * @param maxConcurrency the maximum number of active subscriptions to the MaybeSources. |
| 8486 | + * @return the new Flowable instance |
| 8487 | + */ |
| 8488 | + @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) |
| 8489 | + @SchedulerSupport(SchedulerSupport.NONE) |
| 8490 | + public final <R> Flowable<R> flatMapMaybe(Function<? super T, ? extends MaybeSource<? extends R>> mapper, boolean delayErrors, int maxConcurrency) { |
| 8491 | + ObjectHelper.requireNonNull(mapper, "mapper is null"); |
| 8492 | + ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); |
| 8493 | + return RxJavaPlugins.onAssembly(new FlowableFlatMapMaybe<T, R>(this, mapper, delayErrors, maxConcurrency)); |
| 8494 | + } |
| 8495 | + |
| 8496 | + /** |
| 8497 | + * Maps each element of the upstream Flowable into SingleSources, subscribes to them and |
| 8498 | + * waits until the upstream and all SingleSources complete. |
| 8499 | + * <dl> |
| 8500 | + * <dt><b>Backpressure:</b></dt> |
| 8501 | + * <dd>The operator consumes the upstream in an unbounded manner.</dd> |
| 8502 | + * <dt><b>Scheduler:</b></dt> |
| 8503 | + * <dd>{@code flatMapSingle} does not operate by default on a particular {@link Scheduler}.</dd> |
| 8504 | + * </dl> |
| 8505 | + * @param <R> the result value type |
| 8506 | + * @param mapper the function that received each source value and transforms them into SingleSources. |
| 8507 | + * @return the new Flowable instance |
| 8508 | + */ |
| 8509 | + @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) |
| 8510 | + @SchedulerSupport(SchedulerSupport.NONE) |
| 8511 | + public final <R> Flowable<R> flatMapSingle(Function<? super T, ? extends SingleSource<? extends R>> mapper) { |
| 8512 | + return flatMapSingle(mapper, false, Integer.MAX_VALUE); |
| 8513 | + } |
| 8514 | + |
| 8515 | + /** |
| 8516 | + * Maps each element of the upstream Flowable into SingleSources, subscribes to them and |
| 8517 | + * waits until the upstream and all SingleSources complete, optionally delaying all errors. |
| 8518 | + * <dl> |
| 8519 | + * <dt><b>Backpressure:</b></dt> |
| 8520 | + * <dd>If {@code maxConcurrency == Integer.MAX_VALUE} the operator consumes the upstream in an unbounded manner. |
| 8521 | + * Otherwise the operator expects the upstream to honor backpressure. If the upstream doesn't support backpressure |
| 8522 | + * the operator behaves as if {@code maxConcurrency == Integer.MAX_VALUE} was used.</dd> |
| 8523 | + * <dt><b>Scheduler:</b></dt> |
| 8524 | + * <dd>{@code flatMapSingle} does not operate by default on a particular {@link Scheduler}.</dd> |
| 8525 | + * </dl> |
| 8526 | + * @param <R> the result value type |
| 8527 | + * @param mapper the function that received each source value and transforms them into SingleSources. |
| 8528 | + * @param delayErrors if true errors from the upstream and inner SingleSources are delayed until each of them |
| 8529 | + * terminates. |
| 8530 | + * @param maxConcurrency the maximum number of active subscriptions to the SingleSources. |
| 8531 | + * @return the new Flowable instance |
| 8532 | + */ |
| 8533 | + @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) |
| 8534 | + @SchedulerSupport(SchedulerSupport.NONE) |
| 8535 | + public final <R> Flowable<R> flatMapSingle(Function<? super T, ? extends SingleSource<? extends R>> mapper, boolean delayErrors, int maxConcurrency) { |
| 8536 | + ObjectHelper.requireNonNull(mapper, "mapper is null"); |
| 8537 | + ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); |
| 8538 | + return RxJavaPlugins.onAssembly(new FlowableFlatMapSingle<T, R>(this, mapper, delayErrors, maxConcurrency)); |
| 8539 | + } |
| 8540 | + |
8408 | 8541 | /**
|
8409 | 8542 | * Subscribes to the {@link Publisher} and receives notifications for each element.
|
8410 | 8543 | * <p>
|
|
0 commit comments