@@ -11212,52 +11212,6 @@ public final <R> Flowable<R> lift(FlowableOperator<? extends R, ? super T> lifte
11212
11212
return RxJavaPlugins.onAssembly(new FlowableLift<R, T>(this, lifter));
11213
11213
}
11214
11214
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
-
11261
11215
/**
11262
11216
* Returns a Flowable that applies a specified function to each item emitted by the source Publisher and
11263
11217
* emits the results of these function applications.
@@ -15372,6 +15326,7 @@ public final <R> Flowable<R> switchMapSingleDelayError(@NonNull Function<? super
15372
15326
return RxJavaPlugins.onAssembly(new FlowableSwitchMapSingle<T, R>(this, mapper, true));
15373
15327
}
15374
15328
15329
+
15375
15330
/**
15376
15331
* Returns a Flowable that emits only the first {@code count} items emitted by the source Publisher. If the source emits fewer than
15377
15332
* {@code count} items then all of its items are emitted.
@@ -15381,23 +15336,39 @@ public final <R> Flowable<R> switchMapSingleDelayError(@NonNull Function<? super
15381
15336
* This method returns a Publisher that will invoke a subscribing {@link Subscriber}'s
15382
15337
* {@link Subscriber#onNext onNext} function a maximum of {@code count} times before invoking
15383
15338
* {@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}.
15384
15355
* <dl>
15385
15356
* <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>
15389
15358
* <dt><b>Scheduler:</b></dt>
15390
15359
* <dd>This version of {@code take} does not operate by default on a particular {@link Scheduler}.</dd>
15391
15360
* </dl>
15392
15361
*
15393
15362
* @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.
15395
15366
* @return a Flowable that emits only the first {@code count} items emitted by the source Publisher, or
15396
15367
* all of the items from the source Publisher if that Publisher emits fewer than {@code count} items
15397
15368
* @see <a href="http://reactivex.io/documentation/operators/take.html">ReactiveX operators documentation: Take</a>
15398
15369
*/
15399
15370
@CheckReturnValue
15400
- @BackpressureSupport(BackpressureKind.SPECIAL) // may trigger UNBOUNDED_IN
15371
+ @BackpressureSupport(BackpressureKind.FULL)
15401
15372
@SchedulerSupport(SchedulerSupport.NONE)
15402
15373
public final Flowable<T> take(long count) {
15403
15374
if (count < 0) {
0 commit comments