-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding eager concats to Single #5976
Changes from 6 commits
2d15e07
210b224
3eeab3c
66a8c3b
1625f62
4e27c83
0fc54dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ | |
public abstract class Single<T> implements SingleSource<T> { | ||
|
||
/** | ||
* Runs multiple Single sources and signals the events of the first one that signals (cancelling | ||
* Runs multiple SingleSources and signals the events of the first one that signals (cancelling | ||
* the rest). | ||
* <dl> | ||
* <dt><b>Scheduler:</b></dt> | ||
|
@@ -80,7 +80,7 @@ public static <T> Single<T> amb(final Iterable<? extends SingleSource<? extends | |
} | ||
|
||
/** | ||
* Runs multiple Single sources and signals the events of the first one that signals (cancelling | ||
* Runs multiple SingleSources and signals the events of the first one that signals (cancelling | ||
* the rest). | ||
* <dl> | ||
* <dt><b>Scheduler:</b></dt> | ||
|
@@ -106,7 +106,7 @@ public static <T> Single<T> ambArray(final SingleSource<? extends T>... sources) | |
} | ||
|
||
/** | ||
* Concatenate the single values, in a non-overlapping fashion, of the Single sources provided by | ||
* Concatenate the single values, in a non-overlapping fashion, of the SingleSources provided by | ||
* an Iterable sequence. | ||
* <dl> | ||
* <dt><b>Backpressure:</b></dt> | ||
|
@@ -127,7 +127,7 @@ public static <T> Flowable<T> concat(Iterable<? extends SingleSource<? extends T | |
} | ||
|
||
/** | ||
* Concatenate the single values, in a non-overlapping fashion, of the Single sources provided by | ||
* Concatenate the single values, in a non-overlapping fashion, of the SingleSources provided by | ||
* an Observable sequence. | ||
* <dl> | ||
* <dt><b>Scheduler:</b></dt> | ||
|
@@ -147,7 +147,7 @@ public static <T> Observable<T> concat(ObservableSource<? extends SingleSource<? | |
} | ||
|
||
/** | ||
* Concatenate the single values, in a non-overlapping fashion, of the Single sources provided by | ||
* Concatenate the single values, in a non-overlapping fashion, of the SingleSources provided by | ||
* a Publisher sequence. | ||
* <dl> | ||
* <dt><b>Backpressure:</b></dt> | ||
|
@@ -169,7 +169,7 @@ public static <T> Flowable<T> concat(Publisher<? extends SingleSource<? extends | |
} | ||
|
||
/** | ||
* Concatenate the single values, in a non-overlapping fashion, of the Single sources provided by | ||
* Concatenate the single values, in a non-overlapping fashion, of the SingleSources provided by | ||
* a Publisher sequence and prefetched by the specified amount. | ||
* <dl> | ||
* <dt><b>Backpressure:</b></dt> | ||
|
@@ -299,7 +299,7 @@ public static <T> Flowable<T> concat( | |
} | ||
|
||
/** | ||
* Concatenate the single values, in a non-overlapping fashion, of the Single sources provided in | ||
* Concatenate the single values, in a non-overlapping fashion, of the SingleSources provided in | ||
* an array. | ||
* <dl> | ||
* <dt><b>Backpressure:</b></dt> | ||
|
@@ -320,6 +320,80 @@ public static <T> Flowable<T> concatArray(SingleSource<? extends T>... sources) | |
return RxJavaPlugins.onAssembly(new FlowableConcatMap(Flowable.fromArray(sources), SingleInternalHelper.toFlowable(), 2, ErrorMode.BOUNDARY)); | ||
} | ||
|
||
/** | ||
* Concatenates a sequence of SingleSource eagerly into a single stream of values. | ||
* <p> | ||
* Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the | ||
* source SingleSources. The operator buffers the value emitted by these SingleSources and then drains them | ||
* in order, each one after the previous one completes. | ||
* <dl> | ||
* <dt><b>Backpressure:</b></dt> | ||
* <dd>The operator honors backpressure from downstream.</dd> | ||
* <dt><b>Scheduler:</b></dt> | ||
* <dd>This method does not operate by default on a particular {@link Scheduler}.</dd> | ||
* </dl> | ||
* @param <T> the value type | ||
* @param sources a sequence of Single that need to be eagerly concatenated | ||
* @return the new Flowable instance with the specified concatenation behavior | ||
*/ | ||
@SuppressWarnings({ "rawtypes", "unchecked" }) | ||
@BackpressureSupport(BackpressureKind.FULL) | ||
@CheckReturnValue | ||
@SchedulerSupport(SchedulerSupport.NONE) | ||
public static <T> Flowable<T> concatArrayEager(SingleSource<? extends T>... sources) { | ||
return Flowable.fromArray(sources).concatMapEager(SingleInternalHelper.<T>toFlowable()); | ||
} | ||
|
||
/** | ||
* Concatenates a Publisher sequence of SingleSources eagerly into a single stream of values. | ||
* <p> | ||
* Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the | ||
* emitted source Publishers as they are observed. The operator buffers the values emitted by these | ||
* Publishers and then drains them in order, each one after the previous one completes. | ||
* <dl> | ||
* <dt><b>Backpressure:</b></dt> | ||
* <dd>Backpressure is honored towards the downstream and the outer Publisher is | ||
* expected to support backpressure. Violating this assumption, the operator will | ||
* signal {@link io.reactivex.exceptions.MissingBackpressureException}.</dd> | ||
* <dt><b>Scheduler:</b></dt> | ||
* <dd>This method does not operate by default on a particular {@link Scheduler}.</dd> | ||
* </dl> | ||
* @param <T> the value type | ||
* @param sources a sequence of Publishers that need to be eagerly concatenated | ||
* @return the new Publisher instance with the specified concatenation behavior | ||
*/ | ||
@SuppressWarnings({ "rawtypes", "unchecked" }) | ||
@BackpressureSupport(BackpressureKind.FULL) | ||
@CheckReturnValue | ||
@SchedulerSupport(SchedulerSupport.NONE) | ||
public static <T> Flowable<T> concatEager(Publisher<? extends SingleSource<? extends T>> sources) { | ||
return Flowable.fromPublisher(sources).concatMapEager(SingleInternalHelper.<T>toFlowable()); | ||
} | ||
|
||
/** | ||
* Concatenates a sequence of SingleSources eagerly into a single stream of values. | ||
* <p> | ||
* Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the | ||
* source SingleSources. The operator buffers the values emitted by these SingleSources and then drains them | ||
* in order, each one after the previous one completes. | ||
* <dl> | ||
* <dt><b>Backpressure:</b></dt> | ||
* <dd>Backpressure is honored towards the downstream.</dd> | ||
* <dt><b>Scheduler:</b></dt> | ||
* <dd>This method does not operate by default on a particular {@link Scheduler}.</dd> | ||
* </dl> | ||
* @param <T> the value type | ||
* @param sources a sequence of SingleSource that need to be eagerly concatenated | ||
* @return the new Flowable instance with the specified concatenation behavior | ||
*/ | ||
@SuppressWarnings({ "rawtypes", "unchecked" }) | ||
@BackpressureSupport(BackpressureKind.FULL) | ||
@CheckReturnValue | ||
@SchedulerSupport(SchedulerSupport.NONE) | ||
public static <T> Flowable<T> concatEager(Iterable<? extends SingleSource<? extends T>> sources) { | ||
return Flowable.fromIterable(sources).concatMapEager(SingleInternalHelper.<T>toFlowable()); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is another overload you missed:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops - thanks for the review, will update shortly |
||
/** | ||
* Provides an API (via a cold Completable) that bridges the reactive world with the callback-style world. | ||
* <p> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix these too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 of them found and fixed.