From 01232cb35cf9cfa8796f74a4c6cc386a4973c02c Mon Sep 17 00:00:00 2001 From: David Karnok Date: Wed, 5 Jul 2017 15:46:57 +0200 Subject: [PATCH] 2.x: fix wording of toList, fix a/an in subscribeOn (#5465) --- src/main/java/io/reactivex/Flowable.java | 33 ++++++++++++---------- src/main/java/io/reactivex/Observable.java | 29 ++++++++++--------- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/src/main/java/io/reactivex/Flowable.java b/src/main/java/io/reactivex/Flowable.java index fea12e6ce1..2d7d9cc23c 100644 --- a/src/main/java/io/reactivex/Flowable.java +++ b/src/main/java/io/reactivex/Flowable.java @@ -5573,7 +5573,7 @@ public final T blockingSingle(T defaultItem) { * {@link java.lang.IllegalArgumentException}. If the {@link Flowable} is empty, {@link java.util.concurrent.Future} * will receive an {@link java.util.NoSuchElementException}. *

- * If the {@code Flowable} may emit more than one item, use {@code Flowable.toList().toBlocking().toFuture()}. + * If the {@code Flowable} may emit more than one item, use {@code Flowable.toList().toFuture()}. *

* *

@@ -13056,7 +13056,7 @@ public final > E subscribeWith(E subscriber) { *

* If there is a {@link #create(FlowableOnSubscribe, BackpressureStrategy)} type source up in the * chain, it is recommended to use {@code subscribeOn(scheduler, false)} instead - * to avoid same-pool deadlock because requests may pile up behind a eager/blocking emitter. + * to avoid same-pool deadlock because requests may pile up behind an eager/blocking emitter. *

* *

@@ -13090,7 +13090,7 @@ public final Flowable subscribeOn(@NonNull Scheduler scheduler) { *

* If there is a {@link #create(FlowableOnSubscribe, BackpressureStrategy)} type source up in the * chain, it is recommended to have {@code requestOn} false to avoid same-pool deadlock - * because requests may pile up behind a eager/blocking emitter. + * because requests may pile up behind an eager/blocking emitter. *

* *

@@ -14574,8 +14574,8 @@ public final R to(Function, R> converter) { } /** - * Returns a Single that emits a single item, a list composed of all the items emitted by the source - * Publisher. + * Returns a Single that emits a single item, a list composed of all the items emitted by the + * finite upstream source Publisher. *

* *

@@ -14585,8 +14585,9 @@ public final R to(Function, R> converter) { * function once, passing it the entire list, by calling the Publisher's {@code toList} method prior to * calling its {@link #subscribe} method. *

- * Be careful not to use this operator on Publishers that emit infinite or very large numbers of items, as - * you do not have the option to cancel. + * 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}. *

*
Backpressure:
*
The operator honors backpressure from downstream and consumes the source {@code Publisher} in an @@ -14607,8 +14608,8 @@ public final Single> toList() { } /** - * Returns a Single that emits a single item, a list composed of all the items emitted by the source - * Publisher. + * Returns a Single that emits a single item, a list composed of all the items emitted by the + * finite source Publisher. *

* *

@@ -14618,8 +14619,9 @@ public final Single> toList() { * function once, passing it the entire list, by calling the Publisher's {@code toList} method prior to * calling its {@link #subscribe} method. *

- * Be careful not to use this operator on Publishers that emit infinite or very large numbers of items, as - * you do not have the option to cancel. + * 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}. *

*
Backpressure:
*
The operator honors backpressure from downstream and consumes the source {@code Publisher} in an @@ -14643,8 +14645,8 @@ public final Single> toList(final int capacityHint) { } /** - * Returns a Single that emits a single item, a list composed of all the items emitted by the source - * Publisher. + * Returns a Single that emits a single item, a list composed of all the items emitted by the + * finite source Publisher. *

* *

@@ -14654,8 +14656,9 @@ public final Single> toList(final int capacityHint) { * function once, passing it the entire list, by calling the Publisher's {@code toList} method prior to * calling its {@link #subscribe} method. *

- * Be careful not to use this operator on Publishers that emit infinite or very large numbers of items, as - * you do not have the option to cancel. + * Note that this operator requires the upstream to signal {@code onComplete} for the accumulated collection 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}. *

*
Backpressure:
*
The operator honors backpressure from downstream and consumes the source {@code Publisher} in an diff --git a/src/main/java/io/reactivex/Observable.java b/src/main/java/io/reactivex/Observable.java index e55d8a52ca..20f514e0ef 100644 --- a/src/main/java/io/reactivex/Observable.java +++ b/src/main/java/io/reactivex/Observable.java @@ -5086,7 +5086,7 @@ public final T blockingSingle(T defaultItem) { * {@link java.lang.IllegalArgumentException}. If the {@link Observable} is empty, {@link java.util.concurrent.Future} * will receive an {@link java.util.NoSuchElementException}. *

- * If the {@code Observable} may emit more than one item, use {@code Observable.toList().toBlocking().toFuture()}. + * If the {@code Observable} may emit more than one item, use {@code Observable.toList().toFuture()}. *

* *

@@ -12294,8 +12294,8 @@ public final R to(Function, R> converter) { } /** - * Returns a Single that emits a single item, a list composed of all the items emitted by the source - * ObservableSource. + * Returns a Single that emits a single item, a list composed of all the items emitted by the + * finite source ObservableSource. *

* *

@@ -12305,8 +12305,9 @@ public final R to(Function, R> converter) { * function once, passing it the entire list, by calling the ObservableSource's {@code toList} method prior to * calling its {@link #subscribe} method. *

- * Be careful not to use this operator on ObservableSources that emit infinite or very large numbers of items, as - * you do not have the option to dispose. + * 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}. *

*
Scheduler:
*
{@code toList} does not operate by default on a particular {@link Scheduler}.
@@ -12323,8 +12324,8 @@ public final Single> toList() { } /** - * Returns a Single that emits a single item, a list composed of all the items emitted by the source - * ObservableSource. + * Returns a Single that emits a single item, a list composed of all the items emitted by the + * finite source ObservableSource. *

* *

@@ -12334,8 +12335,9 @@ public final Single> toList() { * function once, passing it the entire list, by calling the ObservableSource's {@code toList} method prior to * calling its {@link #subscribe} method. *

- * Be careful not to use this operator on ObservableSources that emit infinite or very large numbers of items, as - * you do not have the option to dispose. + * 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}. *

*
Scheduler:
*
{@code toList} does not operate by default on a particular {@link Scheduler}.
@@ -12355,8 +12357,8 @@ public final Single> toList(final int capacityHint) { } /** - * Returns a Single that emits a single item, a list composed of all the items emitted by the source - * ObservableSource. + * Returns a Single that emits a single item, a list composed of all the items emitted by the + * finite source ObservableSource. *

* *

@@ -12366,8 +12368,9 @@ public final Single> toList(final int capacityHint) { * function once, passing it the entire list, by calling the ObservableSource's {@code toList} method prior to * calling its {@link #subscribe} method. *

- * Be careful not to use this operator on ObservableSources that emit infinite or very large numbers of items, as - * you do not have the option to dispose. + * Note that this operator requires the upstream to signal {@code onComplete} for the accumulated collection 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}. *

*
Scheduler:
*
{@code toList} does not operate by default on a particular {@link Scheduler}.