Skip
suppress the first n items emitted by an Observable
You can ignore the first n items emitted by an Observable and attend only to those items that come after, by modifying the Observable with the Skip operator.
See Also
- Last
- SkipLast
- SkipUntil
- SkipWhile
- Take
- TakeLast
- TakeUntil
- TakeWhile
- Introduction to Rx: Skip and Take
- RxMarbles:
skip
Language-Specific Information
RxGroovy skip

In RxGroovy, this operator is implemented as skip
.
Sample Code
numbers = Observable.from([1, 2, 3, 4, 5, 6, 7, 8]); numbers.skip(3).subscribe( { println(it); }, // onNext { println("Error: " + it.getMessage()); }, // onError { println("Sequence complete"); } // onCompleted );
4 5 6 7 8 Sequence complete
This variant of skip
does not by default operate on any particular Scheduler.
- Javadoc:
skip(int)

There is also a variant of skip
that takes a temporal duration rather than a quantity of items. It drops those items that are emitted during that initial duration of the source Observable’s lifespan. You set this duration by passing in a length of time and the time units this length is denominated in as parameters to skip
.
This variant of skip
by default operates on the computation
Scheduler, but you may also pass in a Scheduler of your choosing as an optional third parameter.
- Javadoc:
skip(long,TimeUnit)
- Javadoc:
skip(long,TimeUnit,Scheduler)
RxJava 1․x skip

In RxJava, this operator is implemented as skip
.
This variant of skip
does not by default operate on any particular Scheduler.
- Javadoc:
skip(int)

There is also a variant of skip
that takes a temporal duration rather than a quantity of items. It drops those items that are emitted during that initial duration of the source Observable’s lifespan. You set this duration by passing in a length of time and the time units this length is denominated in as parameters to skip
.
This variant of skip
by default operates on the computation
Scheduler, but you may also pass in a Scheduler of your choosing as an optional third parameter.
- Javadoc:
skip(long,TimeUnit)
- Javadoc:
skip(long,TimeUnit,Scheduler)
RxJS skip skipUntilWithTime

RxJS implements the skip
operator.
Sample Code
var source = Rx.Observable.range(0, 5) .skip(3); var subscription = source.subscribe( function (x) { console.log('Next: ' + x); }, function (err) { console.log('Error: ' + err); }, function () { console.log('Completed'); });
Next: 3 Next: 4 Completed
skip
is found in each of the following distributions:
rx.js
rx.all.js
rx.all.compat.js
rx.compat.js
rx.lite.js
rx.lite.compat.js

RxJS also implements a skipUntilWithTime
operator that does not skip a particular quantity of items from the source Observable, but skips items based on chronology. You set this skip period by passing in a parameter to skipUntilWithTime
, in either of these formats:
- a number
- skips items from the source Observable until this many milliseconds have passed since the Observable was subscribed to
- a
Date
- skips items from the source Observable until this absolute time
You may also, optionally, pass in a Scheduler as a second parameter, and the timer will operate on that Scheduler (skipUntilWithTime
uses the timeout
Scheduler by default).
Sample Code
var source = Rx.Observable.timer(0, 1000) .skipUntilWithTime(5000); var subscription = source.subscribe( function (x) { console.log('Next: ' + x); }, function (err) { console.log('Error: ' + err); }, function () { console.log('Completed'); });
Next: 6 Next: 7 Next: 8 Completed
skipUntilWithTime
is found in each of the following distributions:
rx.all.js
rx.all.compat.js
-
rx.time.js
(requiresrx.js
orrx.compat.js
) rx.lite.js
rx.lite.compat.js
RxPHP skip
RxPHP implements this operator as skip
.
Sample Code
//from https://github.com/ReactiveX/RxPHP/blob/master/demo/skip/skip.php use Rx\Observable\ArrayObservable; $observable = Rx\Observable::fromArray([1, 1, 2, 3, 5, 8, 13]); $observable ->skip(3) ->subscribe($stdoutObserver);
Next value: 3 Next value: 5 Next value: 8 Next value: 13 Complete!
© ReactiveX contributors
Licensed under the Apache License 2.0.
http://reactivex.io/documentation/operators/skip.html