Get a Slice of a Stream

suggest change

Example: Get a Stream of 30 elements, containing 21st to 50th (inclusive) element of a collection.

final long n = 20L; // the number of elements to skip
final long maxSize = 30L; // the number of elements the stream should be limited to
final Stream<T> slice =;


Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents