Skipping and taking emissions
Just like the preceding situation in this chapter, where we used the take
operator, there are often some scenarios where you would like to take some of the emissions and skip the remaining ones. The skip
and take
operators are of huge help in those scenarios. They are actually a part of the filtering operators we discussed in the previous chapter; however, honestly, they do deserve a dedicated discussion. So, here it is.
Skipping emissions (skip, skipLast, skipUntil, and skipWhile)
There may be a requirement where you would like to skip some emissions at the beginning or skip emissions until a particular condition is met. You may even have to wait for another producer before taking emissions and skip all remaining ones.
These operators are designed keeping the exact scenario in mind. They help you skip emissions in various ways.
RxKotlin provides us with many variations and overloads of the skip
operator; we will discuss the most important ones among them:
skip
skipLast...