diff --git a/src/main/java/io/reactivex/Flowable.java b/src/main/java/io/reactivex/Flowable.java index c0e51f365f..a7ee737bbf 100644 --- a/src/main/java/io/reactivex/Flowable.java +++ b/src/main/java/io/reactivex/Flowable.java @@ -6706,12 +6706,16 @@ public final Flowable cast(final Class clazz) { } /** - * Collects items emitted by the source Publisher into a single mutable data structure and returns + * Collects items emitted by the finite source Publisher into a single mutable data structure and returns * a Single that emits this structure. *

* *

* This is a simplified version of {@code reduce} that does not need to return the state on each pass. + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulator object 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:
*
This operator does not support backpressure because by intent it will receive all values and reduce @@ -6740,12 +6744,16 @@ public final Single collect(Callable initialItemSupplier, Bi } /** - * Collects items emitted by the source Publisher into a single mutable data structure and returns + * Collects items emitted by the finite source Publisher into a single mutable data structure and returns * a Single that emits this structure. *

* *

* This is a simplified version of {@code reduce} that does not need to return the state on each pass. + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulator object 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:
*
This operator does not support backpressure because by intent it will receive all values and reduce @@ -11065,7 +11073,7 @@ public final Flowable rebatchRequests(int n) { /** * Returns a Maybe that applies a specified accumulator function to the first item emitted by a source * Publisher, then feeds the result of that function along with the second item emitted by the source - * Publisher into the same function, and so on until all items have been emitted by the source Publisher, + * Publisher into the same function, and so on until all items have been emitted by the finite source Publisher, * and emits the final result from the final call to your function as its sole item. *

* If the source is empty, a {@code NoSuchElementException} is signalled. @@ -11075,6 +11083,10 @@ public final Flowable rebatchRequests(int n) { * This technique, which is called "reduce" here, is sometimes called "aggregate," "fold," "accumulate," * "compress," or "inject" in other programming contexts. Groovy, for instance, has an {@code inject} method * that does a similar operation on lists. + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulator object 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 of its downstream consumer and consumes the @@ -11103,7 +11115,7 @@ public final Maybe reduce(BiFunction reducer) { * Returns a Single that applies a specified accumulator function to the first item emitted by a source * Publisher and a specified seed value, then feeds the result of that function along with the second item * emitted by a Publisher into the same function, and so on until all items have been emitted by the - * source Publisher, emitting the final result from the final call to your function as its sole item. + * finite source Publisher, emitting the final result from the final call to your function as its sole item. *

* *

@@ -11128,6 +11140,10 @@ public final Maybe reduce(BiFunction reducer) { * * source.reduceWith(() -> new ArrayList<>(), (list, item) -> list.add(item))); * + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulator object 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 of its downstream consumer and consumes the @@ -11161,7 +11177,7 @@ public final Single reduce(R seed, BiFunction reducer) { * Returns a Single that applies a specified accumulator function to the first item emitted by a source * Publisher and a seed value derived from calling a specified seedSupplier, then feeds the result * of that function along with the second item emitted by a Publisher into the same function, and so on until - * all items have been emitted by the source Publisher, emitting the final result from the final call to your + * all items have been emitted by the finite source Publisher, emitting the final result from the final call to your * function as its sole item. *

* @@ -11169,6 +11185,10 @@ public final Single reduce(R seed, BiFunction reducer) { * This technique, which is called "reduce" here, is sometimes called "aggregate," "fold," "accumulate," * "compress," or "inject" in other programming contexts. Groovy, for instance, has an {@code inject} method * that does a similar operation on lists. + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulator object 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 of its downstream consumer and consumes the @@ -15092,12 +15112,16 @@ public final > Single toList(Callable coll } /** - * Returns a Single that emits a single HashMap containing all items emitted by the source Publisher, + * Returns a Single that emits a single HashMap containing all items emitted by the finite source Publisher, * mapped by the keys returned by a specified {@code keySelector} function. *

* *

* If more than one source item maps to the same key, the HashMap will contain the latest of those items. + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulated map 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 @@ -15123,12 +15147,16 @@ public final Single> toMap(final Function /** * Returns a Single that emits a single HashMap containing values corresponding to items emitted by the - * source Publisher, mapped by the keys returned by a specified {@code keySelector} function. + * finite source Publisher, mapped by the keys returned by a specified {@code keySelector} function. *

* *

* If more than one source item maps to the same key, the HashMap will contain a single entry that * corresponds to the latest of those items. + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulated map 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 @@ -15158,9 +15186,13 @@ public final Single> toMap(final Function * + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulated map 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 @@ -15194,9 +15226,13 @@ public final Single> toMap(final Function * + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulated map 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:
*
This operator does not support backpressure as by intent it is requesting and buffering everything.
@@ -15223,10 +15259,14 @@ public final Single>> toMultimap(Function * + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulated map 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 @@ -15257,9 +15297,13 @@ public final Single>> toMultimap(Function * + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulated map 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 @@ -15300,9 +15344,13 @@ public final Single>> toMultimap( /** * Returns a Single that emits a single Map, returned by a specified {@code mapFactory} function, that * contains an ArrayList of values, extracted by a specified {@code valueSelector} function from items - * emitted by the source Publisher and keyed by the {@code keySelector} function. + * emitted by the finite source Publisher and keyed by the {@code keySelector} function. *

* + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulated map 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 @@ -15354,7 +15402,7 @@ public final Observable toObservable() { } /** - * Returns a Single that emits a list that contains the items emitted by the source Publisher, in a + * Returns a Single that emits a list that contains the items emitted by the finite source Publisher, in a * sorted order. Each item emitted by the Publisher must implement {@link Comparable} with respect to all * other items in the sequence. * @@ -15363,6 +15411,10 @@ public final Observable toObservable() { * sequence is terminated with a {@link ClassCastException}. *

* + *

+ * 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 @@ -15382,10 +15434,14 @@ public final Single> toSortedList() { } /** - * Returns a Single that emits a list that contains the items emitted by the source Publisher, in a + * Returns a Single that emits a list that contains the items emitted by the finite source Publisher, in a * sorted order based on a specified comparison function. *

* + *

+ * 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 @@ -15410,10 +15466,14 @@ public final Single> toSortedList(final Comparator comparator } /** - * Returns a Single that emits a list that contains the items emitted by the source Publisher, in a + * Returns a Single that emits a list that contains the items emitted by the finite source Publisher, in a * sorted order based on a specified comparison function. *

* + *

+ * 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 @@ -15441,7 +15501,7 @@ public final Single> toSortedList(final Comparator comparator } /** - * Returns a Flowable that emits a list that contains the items emitted by the source Publisher, in a + * Returns a Flowable that emits a list that contains the items emitted by the finite source Publisher, in a * sorted order. Each item emitted by the Publisher must implement {@link Comparable} with respect to all * other items in the sequence. * @@ -15450,6 +15510,10 @@ public final Single> toSortedList(final Comparator comparator * sequence is terminated with a {@link ClassCastException}. *

* + *

+ * 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 diff --git a/src/main/java/io/reactivex/Observable.java b/src/main/java/io/reactivex/Observable.java index f2db8f5e67..2cdafe8325 100644 --- a/src/main/java/io/reactivex/Observable.java +++ b/src/main/java/io/reactivex/Observable.java @@ -6116,12 +6116,16 @@ public final Observable cast(final Class clazz) { } /** - * Collects items emitted by the source ObservableSource into a single mutable data structure and returns + * Collects items emitted by the finite source ObservableSource into a single mutable data structure and returns * a Single that emits this structure. *

* *

* This is a simplified version of {@code reduce} that does not need to return the state on each pass. + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulator object 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 collect} does not operate by default on a particular {@link Scheduler}.
@@ -6146,12 +6150,16 @@ public final Single collect(Callable initialValueSupplier, B } /** - * Collects items emitted by the source ObservableSource into a single mutable data structure and returns + * Collects items emitted by the finite source ObservableSource into a single mutable data structure and returns * a Single that emits this structure. *

* *

* This is a simplified version of {@code reduce} that does not need to return the state on each pass. + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulator object 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 collectInto} does not operate by default on a particular {@link Scheduler}.
@@ -9357,7 +9365,7 @@ public final Observable publish(Function, ? extends /** * Returns a Maybe that applies a specified accumulator function to the first item emitted by a source * ObservableSource, then feeds the result of that function along with the second item emitted by the source - * ObservableSource into the same function, and so on until all items have been emitted by the source ObservableSource, + * ObservableSource into the same function, and so on until all items have been emitted by the finite source ObservableSource, * and emits the final result from the final call to your function as its sole item. *

* @@ -9365,6 +9373,10 @@ public final Observable publish(Function, ? extends * This technique, which is called "reduce" here, is sometimes called "aggregate," "fold," "accumulate," * "compress," or "inject" in other programming contexts. Groovy, for instance, has an {@code inject} method * that does a similar operation on lists. + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulator object 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 reduce} does not operate by default on a particular {@link Scheduler}.
@@ -9389,7 +9401,7 @@ public final Maybe reduce(BiFunction reducer) { * Returns a Single that applies a specified accumulator function to the first item emitted by a source * ObservableSource and a specified seed value, then feeds the result of that function along with the second item * emitted by an ObservableSource into the same function, and so on until all items have been emitted by the - * source ObservableSource, emitting the final result from the final call to your function as its sole item. + * finite source ObservableSource, emitting the final result from the final call to your function as its sole item. *

* *

@@ -9414,6 +9426,10 @@ public final Maybe reduce(BiFunction reducer) { * * source.reduceWith(() -> new ArrayList<>(), (list, item) -> list.add(item))); * + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulator object 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 reduce} does not operate by default on a particular {@link Scheduler}.
@@ -9443,7 +9459,7 @@ public final Single reduce(R seed, BiFunction reducer) { * Returns a Single that applies a specified accumulator function to the first item emitted by a source * ObservableSource and a seed value derived from calling a specified seedSupplier, then feeds the result * of that function along with the second item emitted by an ObservableSource into the same function, - * and so on until all items have been emitted by the source ObservableSource, emitting the final result + * and so on until all items have been emitted by the finite source ObservableSource, emitting the final result * from the final call to your function as its sole item. *

* @@ -9451,6 +9467,10 @@ public final Single reduce(R seed, BiFunction reducer) { * This technique, which is called "reduce" here, is sometimes called "aggregate," "fold," "accumulate," * "compress," or "inject" in other programming contexts. Groovy, for instance, has an {@code inject} method * that does a similar operation on lists. + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulator object 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 reduceWith} does not operate by default on a particular {@link Scheduler}.
@@ -12845,12 +12865,17 @@ public final > Single toList(Callable coll } /** - * Returns a Single that emits a single HashMap containing all items emitted by the source ObservableSource, - * mapped by the keys returned by a specified {@code keySelector} function. + * Returns a Single that emits a single HashMap containing all items emitted by the + * finite source ObservableSource, mapped by the keys returned by a specified + * {@code keySelector} function. *

* *

* If more than one source item maps to the same key, the HashMap will contain the latest of those items. + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulated map 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 toMap} does not operate by default on a particular {@link Scheduler}.
@@ -12872,12 +12897,16 @@ public final Single> toMap(final Function /** * Returns a Single that emits a single HashMap containing values corresponding to items emitted by the - * source ObservableSource, mapped by the keys returned by a specified {@code keySelector} function. + * finite source ObservableSource, mapped by the keys returned by a specified {@code keySelector} function. *

* *

* If more than one source item maps to the same key, the HashMap will contain a single entry that * corresponds to the latest of those items. + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulated map 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 toMap} does not operate by default on a particular {@link Scheduler}.
@@ -12905,9 +12934,13 @@ public final Single> toMap( /** * Returns a Single that emits a single Map, returned by a specified {@code mapFactory} function, that - * contains keys and values extracted from the items emitted by the source ObservableSource. + * contains keys and values extracted from the items emitted by the finite source ObservableSource. *

* + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulated map 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 toMap} does not operate by default on a particular {@link Scheduler}.
@@ -12939,9 +12972,13 @@ public final Single> toMap( /** * Returns a Single that emits a single HashMap that contains an ArrayList of items emitted by the - * source ObservableSource keyed by a specified {@code keySelector} function. + * finite source ObservableSource keyed by a specified {@code keySelector} function. *

* + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulated map 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 toMultimap} does not operate by default on a particular {@link Scheduler}.
@@ -12966,10 +13003,14 @@ public final Single>> toMultimap(Function * + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulated map 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 toMultimap} does not operate by default on a particular {@link Scheduler}.
@@ -13035,9 +13076,13 @@ public final Single>> toMultimap( /** * Returns a Single that emits a single Map, returned by a specified {@code mapFactory} function, that * contains an ArrayList of values, extracted by a specified {@code valueSelector} function from items - * emitted by the source ObservableSource and keyed by the {@code keySelector} function. + * emitted by the finite source ObservableSource and keyed by the {@code keySelector} function. *

* + *

+ * Note that this operator requires the upstream to signal {@code onComplete} for the accumulated map 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 toMultimap} does not operate by default on a particular {@link Scheduler}.
@@ -13122,7 +13167,7 @@ public final Flowable toFlowable(BackpressureStrategy strategy) { } /** - * Returns a Single that emits a list that contains the items emitted by the source ObservableSource, in a + * Returns a Single that emits a list that contains the items emitted by the finite source ObservableSource, in a * sorted order. Each item emitted by the ObservableSource must implement {@link Comparable} with respect to all * other items in the sequence. * @@ -13131,6 +13176,10 @@ public final Flowable toFlowable(BackpressureStrategy strategy) { * sequence is terminated with a {@link ClassCastException}. *

* + *

+ * 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 toSortedList} does not operate by default on a particular {@link Scheduler}.
@@ -13146,10 +13195,14 @@ public final Single> toSortedList() { } /** - * Returns a Single that emits a list that contains the items emitted by the source ObservableSource, in a + * Returns a Single that emits a list that contains the items emitted by the finite source ObservableSource, in a * sorted order based on a specified comparison function. *

* + *

+ * 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 toSortedList} does not operate by default on a particular {@link Scheduler}.
@@ -13170,10 +13223,14 @@ public final Single> toSortedList(final Comparator comparator } /** - * Returns a Single that emits a list that contains the items emitted by the source ObservableSource, in a + * Returns a Single that emits a list that contains the items emitted by the finite source ObservableSource, in a * sorted order based on a specified comparison function. *

* + *

+ * 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 toSortedList} does not operate by default on a particular {@link Scheduler}.
@@ -13197,7 +13254,7 @@ public final Single> toSortedList(final Comparator comparator } /** - * Returns a Single that emits a list that contains the items emitted by the source ObservableSource, in a + * Returns a Single that emits a list that contains the items emitted by the finite source ObservableSource, in a * sorted order. Each item emitted by the ObservableSource must implement {@link Comparable} with respect to all * other items in the sequence. * @@ -13206,6 +13263,10 @@ public final Single> toSortedList(final Comparator comparator * sequence is terminated with a {@link ClassCastException}. *

* + *

+ * 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 toSortedList} does not operate by default on a particular {@link Scheduler}.