From 2d5ce6935910cb3046384254329bd46236802796 Mon Sep 17 00:00:00 2001 From: Dave Moten Date: Fri, 19 Jun 2015 09:49:20 +1000 Subject: [PATCH] takeLast javadoc fixes, standardize on parameter names (count instead of num), improve message in OperatorTakeLast exception --- src/main/java/rx/Observable.java | 56 ++++++++++--------- .../internal/operators/OperatorTakeLast.java | 4 +- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/src/main/java/rx/Observable.java b/src/main/java/rx/Observable.java index c576ea59f9..8069a7b1da 100644 --- a/src/main/java/rx/Observable.java +++ b/src/main/java/rx/Observable.java @@ -5141,28 +5141,28 @@ public final Observable lastOrDefault(T defaultValue, Func1 * Alias of {@link #take(int)} to match Java 8 Stream API naming convention. *

* *

* This method returns an Observable that will invoke a subscribing {@link Observer}'s - * {@link Observer#onNext onNext} function a maximum of {@code num} times before invoking + * {@link Observer#onNext onNext} function a maximum of {@code count} times before invoking * {@link Observer#onCompleted onCompleted}. *

*
Scheduler:
*
{@code limit} does not operate by default on a particular {@link Scheduler}.
*
* - * @param num + * @param count * the maximum number of items to emit - * @return an Observable that emits only the first {@code num} items emitted by the source Observable, or - * all of the items from the source Observable if that Observable emits fewer than {@code num} items + * @return an Observable that emits only the first {@code count} items emitted by the source Observable, or + * all of the items from the source Observable if that Observable emits fewer than {@code count} items * @see ReactiveX operators documentation: Take */ - public final Observable limit(int num) { - return take(num); + public final Observable limit(int count) { + return take(count); } /** @@ -6894,7 +6894,7 @@ public final Observable singleOrDefault(T defaultValue, Func1 * @@ -6903,14 +6903,14 @@ public final Observable singleOrDefault(T defaultValue, Func1This version of {@code skip} does not operate by default on a particular {@link Scheduler}. * * - * @param num + * @param count * the number of items to skip * @return an Observable that is identical to the source Observable except that it does not emit the first - * {@code num} items that the source Observable emits + * {@code count} items that the source Observable emits * @see ReactiveX operators documentation: Skip */ - public final Observable skip(int num) { - return lift(new OperatorSkip(num)); + public final Observable skip(int count) { + return lift(new OperatorSkip(count)); } /** @@ -7766,26 +7766,27 @@ public final Observable switchMap(Func1 * *

* This method returns an Observable that will invoke a subscribing {@link Observer}'s - * {@link Observer#onNext onNext} function a maximum of {@code num} times before invoking + * {@link Observer#onNext onNext} function a maximum of {@code count} times before invoking * {@link Observer#onCompleted onCompleted}. *

*
Scheduler:
*
This version of {@code take} does not operate by default on a particular {@link Scheduler}.
*
* - * @param num + * @param count * the maximum number of items to emit - * @return an Observable that emits only the first {@code num} items emitted by the source Observable, or - * all of the items from the source Observable if that Observable emits fewer than {@code num} items + * @return an Observable that emits only the first {@code count} items emitted by the source Observable, or + * all of the items from the source Observable if that Observable emits fewer than {@code count} items * @see ReactiveX operators documentation: Take */ - public final Observable take(final int num) { - return lift(new OperatorTake(num)); + public final Observable take(final int count) { + return lift(new OperatorTake(count)); } /** @@ -7855,7 +7856,8 @@ public final Observable takeFirst(Func1 predicate) { } /** - * Returns an Observable that emits only the last {@code count} items emitted by the source Observable. + * Returns an Observable that emits at most the last {@code count} items emitted by the source Observable. If the source emits fewer than + * {@code count} items then all of its items are emitted. *

* *

@@ -7864,9 +7866,9 @@ public final Observable takeFirst(Func1 predicate) { *
* * @param count - * the number of items to emit from the end of the sequence of items emitted by the source + * the maximum number of items to emit from the end of the sequence of items emitted by the source * Observable - * @return an Observable that emits only the last {@code count} items emitted by the source Observable + * @return an Observable that emits at most the last {@code count} items emitted by the source Observable * @throws IndexOutOfBoundsException * if {@code count} is less than zero * @see ReactiveX operators documentation: TakeLast @@ -7882,7 +7884,7 @@ else if (count == 1 ) /** * Returns an Observable that emits at most a specified number of items from the source Observable that were - * emitted in a specified window of time before the Observable completed. + * emitted in a specified window of time before the Observable completed. *

* *

@@ -7983,8 +7985,8 @@ public final Observable takeLast(long time, TimeUnit unit, Scheduler schedule } /** - * Returns an Observable that emits a single List containing the last {@code count} elements emitted by the - * source Observable. + * Returns an Observable that emits a single List containing at most the last {@code count} elements emitted by the + * source Observable. If the source emits fewer than {@code count} items then the emitted List will contain all of the source emissions. *

* *

@@ -7993,8 +7995,8 @@ public final Observable takeLast(long time, TimeUnit unit, Scheduler schedule *
* * @param count - * the number of items to emit in the list - * @return an Observable that emits a single list containing the last {@code count} elements emitted by the + * the maximum number of items to emit in the list + * @return an Observable that emits a single list containing at most the last {@code count} elements emitted by the * source Observable * @see ReactiveX operators documentation: TakeLast */ diff --git a/src/main/java/rx/internal/operators/OperatorTakeLast.java b/src/main/java/rx/internal/operators/OperatorTakeLast.java index fb547f711b..54c1a0c43a 100644 --- a/src/main/java/rx/internal/operators/OperatorTakeLast.java +++ b/src/main/java/rx/internal/operators/OperatorTakeLast.java @@ -22,7 +22,7 @@ import rx.Subscriber; /** - * Returns an Observable that emits the last count items emitted by the source Observable. + * Returns an Observable that emits the at most the last count items emitted by the source Observable. *

* */ @@ -32,7 +32,7 @@ public final class OperatorTakeLast implements Operator { public OperatorTakeLast(int count) { if (count < 0) { - throw new IndexOutOfBoundsException("count could not be negative"); + throw new IndexOutOfBoundsException("count cannot be negative"); } this.count = count; }