Chapter 6: Observable operators
We will see the following operators on Observables:
- filter
- take
- takeWhile
- takeLast
- skip
- skipLast
- skipWhile
- distinct
- distinctUntilChanges
filter
You can filter the output stream of the Observable by calling filter and provide for each item a filter rule
take
The take operators are the following:
- take: Take an n-elements or during n TimeUnits
- takeWhile: While the condition is true, take the elements
- takeUntil: When the condition is true, takes the elements after that
- takeLast: Take the last n elements
- elemenAt: Take the elements at the specific position and then call onComplete and dispose the observable You can take** using a number or using a time value.
skip
The skip operators are the following:
- skip: Skip the n-elements or during n TimeUnits
- skipWhile: While the condition is true, skip the elements
- skipUntil: When the condition is true start skipping, takes the elements after that
- skipLast: Skip the last n elements (need to wait for the onComplete to be called) You can skip** using a number or using a time value.
distinct
The distinct operators are the following:
- distinct: Insure all the elements are different
- distinctUntilChanged: Insure two continuous elements are not the same
Chapter 5 : Dispoable, Single, Maybe and Completable concepts
Chapter 7 : Observables’s Transformer Operators
TableOfContent
More on the topic
Previous chapter: Chapter 5: Disposables and Specific Observables: Single/MayBe/Completable
Next chapter: Chapter 7: Observable transformers operators
This chapter is a small part of a biggest training project, you can find on Github. You’ll have the main branch with the answers/responses/unit tests and documentation. You could start with the “questions” branch to only have the questions.
You’ll have the full table of content of the articles on Medium.
You can download the book on Android2ee
Warning: Those articles has been created only because I am stuck in a Rx Android project and I need to prepare the ramp up for those who will replace me.
My conclusion : Choose Kotlin and suspending function instead of Rx. PLEASE, save your project from RxHell !!!
Write Medium in Markdown? Try Markdium!