Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

longCount -> countLong #1740

Merged
merged 1 commit into from
Oct 10, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions src/main/java/rx/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -3659,6 +3659,34 @@ public final Integer call(Integer t1, T t2) {
}
});
}

/**
* Returns an Observable that counts the total number of items emitted by the source Observable and emits
* this count as a 64-bit Long.
* <p>
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/longCount.png" alt="">
* <dl>
* <dt><b>Backpressure Support:</b></dt>
* <dd>This operator does not support backpressure because by intent it will receive all values and reduce
* them to a single {@code onNext}.</dd>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code longCount} does not operate by default on a particular {@link Scheduler}.</dd>
* </dl>
*
* @return an Observable that emits a single item: the number of items emitted by the source Observable as a
* 64-bit Long item
* @see <a href="https://github.com/ReactiveX/RxJava/wiki/Mathematical-and-Aggregate-Operators#count-and-longcount">RxJava wiki: count</a>
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229120.aspx">MSDN: Observable.LongCount</a>
* @see #count()
*/
public final Observable<Long> countLong() {
return reduce(0L, new Func2<Long, T, Long>() {
@Override
public final Long call(Long t1, T t2) {
return t1 + 1;
}
});
}

/**
* Returns an Observable that mirrors the source Observable, except that it drops items emitted by the
Expand Down Expand Up @@ -4992,34 +5020,6 @@ public final Observable<T> limit(int num) {
return take(num);
}

/**
* Returns an Observable that counts the total number of items emitted by the source Observable and emits
* this count as a 64-bit Long.
* <p>
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/longCount.png" alt="">
* <dl>
* <dt><b>Backpressure Support:</b></dt>
* <dd>This operator does not support backpressure because by intent it will receive all values and reduce
* them to a single {@code onNext}.</dd>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code longCount} does not operate by default on a particular {@link Scheduler}.</dd>
* </dl>
*
* @return an Observable that emits a single item: the number of items emitted by the source Observable as a
* 64-bit Long item
* @see <a href="https://github.com/ReactiveX/RxJava/wiki/Mathematical-and-Aggregate-Operators#count-and-longcount">RxJava wiki: count</a>
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229120.aspx">MSDN: Observable.LongCount</a>
* @see #count()
*/
public final Observable<Long> longCount() {
return reduce(0L, new Func2<Long, T, Long>() {
@Override
public final Long call(Long t1, T t2) {
return t1 + 1;
}
});
}

/**
* Returns an Observable that applies a specified function to each item emitted by the source Observable and
* emits the results of these function applications.
Expand Down