The ignoreElements operator

Sometimes, you may require to listen only on the onComplete of a producer. The ignoreElements operator helps you to do that. Please refer to the following code:

    fun main(args: Array<String>) { 
      val observable = Observable.range(1,10) 
      observable 
        .ignoreElements() 
        .subscribe { println("Completed") }//(1) 
    } 

The ignoreElements operator returns a Completable monad, which only has the onComplete event.

We will look into the skip and take operators in Chapter 6More on Operators and Error Handling while discussing conditional operators.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.94.190