Skip and SkipLast

The next figure shows how we can apply skip(2) to create a sequence that doesn't emit the first two elements of an Observable source but emits all the next items:

Skip and SkipLast

The skip() and skipLast() functions are the counterpart of take() and takeLast(). They get an integer N as a parameter and, basically, they suppress the first N or last N values emitted by an Observable. We can use it if we know that a sequence starts or ends with a control element that is not strictly useful for our purpose.

The next figure shows the counterpart scenario of the previous one: we are creating a new sequence that emits every item from the Observable source but skips the last two elements:

Skip and SkipLast
..................Content has been hidden....................

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