The Count operator transforms an Observable that emits items into an Observable that emits a single value that represents the number of items emitted by the source Observable.
If the source Observable terminates with an error, Count will pass this error notification along without emitting an item first. If the source Observable does not terminate at all, Count will neither emit an item nor terminate.
      RxClojure has both count and longCount variants of this operator,
      but both of these in fact return long values.
     
      RxCpp implements this operator as count.
     
      In RxGroovy the operator is called count and the Observable it creates emits an
      Integer value. There is also a countLong whose Observable emits a Long value.
     
def myObservable = Observable.create({ aSubscriber ->
  if(false == aSubscriber.isUnsubscribed()) aSubscriber.onNext('Three');
  if(false == aSubscriber.isUnsubscribed()) aSubscriber.onNext('Two');
  if(false == aSubscriber.isUnsubscribed()) aSubscriber.onNext('One');
  if(false == aSubscriber.isUnsubscribed()) aSubscriber.onCompleted();
});
myObservable.count().subscribe(
   { println(it); },                          // onNext
   { println("Error: " + it.getMessage()); }, // onError
   { println("Sequence complete"); }          // onCompleted
);3 Sequence complete
count()countLong()
      In RxJava the operator is called count and the Observable it creates emits an
      Integer value. There is also a countLong whose Observable emits a Long value.
     
String[] items = new String[] { "one", "two", "three" };
assertEquals( new Integer(3), Observable.from(items).count().toBlocking().single() );count()countLong()
      In RxJS the operator count counts the number of items in the source Observable
      that satisfy a specified predicate. That predicate takes the form of a function that takes
      three parameters:
     
      If the predicate function returns true, count will increment the
      tally of items that it will report when the source Observable completes. If you want to count
      all of the items emitted by the source Observable, simply pass count a
      predicate that always returns true:
     
numberOfItems = someObservable.count(function() { return true; });
      count is part of the following packages:
     
rx.all.jsrx.all.compat.jsrx.aggregates.js
      count requires one of any of the following packages:
     
rx.jsrx.compat.jsrx.lite.jsrx.lite.compat.js
      RxKotlin implements this operator as count.
     
val list = listOf(1, 2, 3, 4, 5) assertEquals( 5, Observable.from(list)!!.count()!!.toBlocking()!!.single() )
      In Rx.NET the Observable this operator creates emits an Integer value, but there is also a
      LongCount whose Observable emits a Long value. With both variants, you can either
      pass the source Observable in to the operator as a parameter or you can call the operator as
      an instance method of the source Observable (in which case you omit the parameter).
     
    RxPHP implements this operator as count.
    
Returns an observable sequence containing a value that represents how many elements in the specified observable sequence satisfy a condition if provided, else the count of items.
//from https://github.com/ReactiveX/RxPHP/blob/master/demo/count/count.php $source = \Rx\Observable::fromArray(range(1, 10)); $subscription = $source->count()->subscribe($stdoutObserver);
Next value: 10
Complete!
    
      In RxPY you have the option to pass count a predicate that takes an item emitted
      by the source Observable as a parameter. If you do so, count will emit a count
      only of those items from the source Observable that the predicate evaluates as
      true. Otherwise, it will emit a count of all items emitted by the source
      Observable.
     
numberOfItems = someObservable.count() numberOfNegativeItems = someObservable.count(lambda x: x < 0)
      In Rx.rb you have the option to pass count a predicate that takes an item emitted
      by the source Observable as a parameter. If you do so, count will emit a count
      only of those items from the source Observable that the predicate evaluates as
      true. Otherwise it will emit a count of all items emitted by the source
      Observable.
     
      In RxScala the operator count counts the number of items in the source Observable
      that satisfy a specified predicate. That predicate accepts an emitted item as a parameter and
      returns a Boolean. count will emit a count of all items for which this predicate
      returned true.
     
      Use length or size instead if you want to count all of the
      items emitted by the source Observable and emit this count as an Integer, or use
      longCount to emit it as a Long.