Skip to content

Commit ea13546

Browse files
Merge pull request #1740 from benjchristensen/countLong
longCount -> countLong
2 parents 3e7f71f + fa839bb commit ea13546

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/main/java/rx/Observable.java

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3659,6 +3659,34 @@ public final Integer call(Integer t1, T t2) {
36593659
}
36603660
});
36613661
}
3662+
3663+
/**
3664+
* Returns an Observable that counts the total number of items emitted by the source Observable and emits
3665+
* this count as a 64-bit Long.
3666+
* <p>
3667+
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/longCount.png" alt="">
3668+
* <dl>
3669+
* <dt><b>Backpressure Support:</b></dt>
3670+
* <dd>This operator does not support backpressure because by intent it will receive all values and reduce
3671+
* them to a single {@code onNext}.</dd>
3672+
* <dt><b>Scheduler:</b></dt>
3673+
* <dd>{@code longCount} does not operate by default on a particular {@link Scheduler}.</dd>
3674+
* </dl>
3675+
*
3676+
* @return an Observable that emits a single item: the number of items emitted by the source Observable as a
3677+
* 64-bit Long item
3678+
* @see <a href="https://github.com/ReactiveX/RxJava/wiki/Mathematical-and-Aggregate-Operators#count-and-longcount">RxJava wiki: count</a>
3679+
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229120.aspx">MSDN: Observable.LongCount</a>
3680+
* @see #count()
3681+
*/
3682+
public final Observable<Long> countLong() {
3683+
return reduce(0L, new Func2<Long, T, Long>() {
3684+
@Override
3685+
public final Long call(Long t1, T t2) {
3686+
return t1 + 1;
3687+
}
3688+
});
3689+
}
36623690

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

4995-
/**
4996-
* Returns an Observable that counts the total number of items emitted by the source Observable and emits
4997-
* this count as a 64-bit Long.
4998-
* <p>
4999-
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/longCount.png" alt="">
5000-
* <dl>
5001-
* <dt><b>Backpressure Support:</b></dt>
5002-
* <dd>This operator does not support backpressure because by intent it will receive all values and reduce
5003-
* them to a single {@code onNext}.</dd>
5004-
* <dt><b>Scheduler:</b></dt>
5005-
* <dd>{@code longCount} does not operate by default on a particular {@link Scheduler}.</dd>
5006-
* </dl>
5007-
*
5008-
* @return an Observable that emits a single item: the number of items emitted by the source Observable as a
5009-
* 64-bit Long item
5010-
* @see <a href="https://github.com/ReactiveX/RxJava/wiki/Mathematical-and-Aggregate-Operators#count-and-longcount">RxJava wiki: count</a>
5011-
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229120.aspx">MSDN: Observable.LongCount</a>
5012-
* @see #count()
5013-
*/
5014-
public final Observable<Long> longCount() {
5015-
return reduce(0L, new Func2<Long, T, Long>() {
5016-
@Override
5017-
public final Long call(Long t1, T t2) {
5018-
return t1 + 1;
5019-
}
5020-
});
5021-
}
5022-
50235023
/**
50245024
* Returns an Observable that applies a specified function to each item emitted by the source Observable and
50255025
* emits the results of these function applications.

0 commit comments

Comments
 (0)