The skip operator

Now that we have found ways to select data, let's look at ways to reject data. The Reactor API offers diverse methods to reject data. There is a skip operator, with the following types:

  • Skip(count): This will reject the specified number of elements from the beginning of the stream.
  • Skip(Duration): This will reject elements for the said duration from the beginning of the stream.
  • SkipLast(count): This will reject a specified number of elements from the end of the stream.
  • SkipUntil(Boolean Predicate): This will reject elements until the first occurrence of the said condition is true.

The preceding commands are shown in the following code:

fibonacciGenerator.skip(10).subscribe(t -> {
    System.out.println(t);
});
fibonacciGenerator.skip(Duration.ofMillis( ...

Get Hands-On Reactive Programming with Reactor now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.