@@ -11212,52 +11212,6 @@ public final <R> Flowable<R> lift(FlowableOperator<? extends R, ? super T> lifte
1121211212 return RxJavaPlugins.onAssembly(new FlowableLift<R, T>(this, lifter));
1121311213 }
1121411214
11215- /**
11216- * Limits both the number of upstream items (after which the sequence completes)
11217- * and the total downstream request amount requested from the upstream to
11218- * possibly prevent the creation of excess items by the upstream.
11219- * <p>
11220- * The operator requests at most the given {@code count} of items from upstream even
11221- * if the downstream requests more than that. For example, given a {@code limit(5)},
11222- * if the downstream requests 1, a request of 1 is submitted to the upstream
11223- * and the operator remembers that only 4 items can be requested now on. A request
11224- * of 5 at this point will request 4 from the upstream and any subsequent requests will
11225- * be ignored.
11226- * <p>
11227- * Note that requests are negotiated on an operator boundary and {@code limit}'s amount
11228- * may not be preserved further upstream. For example,
11229- * {@code source.observeOn(Schedulers.computation()).limit(5)} will still request the
11230- * default (128) elements from the given {@code source}.
11231- * <p>
11232- * The main use of this operator is with sources that are async boundaries that
11233- * don't interfere with request amounts, such as certain {@code Flowable}-based
11234- * network endpoints that relay downstream request amounts unchanged and are, therefore,
11235- * prone to trigger excessive item creation/transmission over the network.
11236- * <dl>
11237- * <dt><b>Backpressure:</b></dt>
11238- * <dd>The operator requests a total of the given {@code count} items from the upstream.</dd>
11239- * <dt><b>Scheduler:</b></dt>
11240- * <dd>{@code limit} does not operate by default on a particular {@link Scheduler}.</dd>
11241- * </dl>
11242- * <p>History: 2.1.6 - experimental
11243- * @param count the maximum number of items and the total request amount, non-negative.
11244- * Zero will immediately cancel the upstream on subscription and complete
11245- * the downstream.
11246- * @return the new Flowable instance
11247- * @see #take(long)
11248- * @see #rebatchRequests(int)
11249- * @since 2.2
11250- */
11251- @BackpressureSupport(BackpressureKind.SPECIAL)
11252- @SchedulerSupport(SchedulerSupport.NONE)
11253- @CheckReturnValue
11254- public final Flowable<T> limit(long count) {
11255- if (count < 0) {
11256- throw new IllegalArgumentException("count >= 0 required but it was " + count);
11257- }
11258- return RxJavaPlugins.onAssembly(new FlowableLimit<T>(this, count));
11259- }
11260-
1126111215 /**
1126211216 * Returns a Flowable that applies a specified function to each item emitted by the source Publisher and
1126311217 * emits the results of these function applications.
@@ -15372,6 +15326,7 @@ public final <R> Flowable<R> switchMapSingleDelayError(@NonNull Function<? super
1537215326 return RxJavaPlugins.onAssembly(new FlowableSwitchMapSingle<T, R>(this, mapper, true));
1537315327 }
1537415328
15329+
1537515330 /**
1537615331 * Returns a Flowable that emits only the first {@code count} items emitted by the source Publisher. If the source emits fewer than
1537715332 * {@code count} items then all of its items are emitted.
@@ -15381,23 +15336,39 @@ public final <R> Flowable<R> switchMapSingleDelayError(@NonNull Function<? super
1538115336 * This method returns a Publisher that will invoke a subscribing {@link Subscriber}'s
1538215337 * {@link Subscriber#onNext onNext} function a maximum of {@code count} times before invoking
1538315338 * {@link Subscriber#onComplete onComplete}.
15339+ * <p>
15340+ * Limits both the number of upstream items (after which the sequence completes)
15341+ * and the total downstream request amount requested from the upstream to
15342+ * possibly prevent the creation of excess items by the upstream.
15343+ * <p>
15344+ * The operator requests at most the given {@code count} of items from upstream even
15345+ * if the downstream requests more than that. For example, given a {@code limit(5)},
15346+ * if the downstream requests 1, a request of 1 is submitted to the upstream
15347+ * and the operator remembers that only 4 items can be requested now on. A request
15348+ * of 5 at this point will request 4 from the upstream and any subsequent requests will
15349+ * be ignored.
15350+ * <p>
15351+ * Note that requests are negotiated on an operator boundary and {@code limit}'s amount
15352+ * may not be preserved further upstream. For example,
15353+ * {@code source.observeOn(Schedulers.computation()).limit(5)} will still request the
15354+ * default (128) elements from the given {@code source}.
1538415355 * <dl>
1538515356 * <dt><b>Backpressure:</b></dt>
15386- * <dd>The operator doesn't interfere with backpressure which is determined by the source {@code Publisher}'s backpressure
15387- * behavior in case the first request is smaller than the {@code count}. Otherwise, the source {@code Publisher}
15388- * is consumed in an unbounded manner (i.e., without applying backpressure to it).</dd>
15357+ * <dd>The source {@code Publisher} is consumed in a bounded manner.</dd>
1538915358 * <dt><b>Scheduler:</b></dt>
1539015359 * <dd>This version of {@code take} does not operate by default on a particular {@link Scheduler}.</dd>
1539115360 * </dl>
1539215361 *
1539315362 * @param count
15394- * the maximum number of items to emit
15363+ * the maximum number of items and the total request amount, non-negative.
15364+ * Zero will immediately cancel the upstream on subscription and complete
15365+ * the downstream.
1539515366 * @return a Flowable that emits only the first {@code count} items emitted by the source Publisher, or
1539615367 * all of the items from the source Publisher if that Publisher emits fewer than {@code count} items
1539715368 * @see <a href="http://reactivex.io/documentation/operators/take.html">ReactiveX operators documentation: Take</a>
1539815369 */
1539915370 @CheckReturnValue
15400- @BackpressureSupport(BackpressureKind.SPECIAL) // may trigger UNBOUNDED_IN
15371+ @BackpressureSupport(BackpressureKind.FULL)
1540115372 @SchedulerSupport(SchedulerSupport.NONE)
1540215373 public final Flowable<T> take(long count) {
1540315374 if (count < 0) {
0 commit comments