LongStream skip(long n) returns a stream consisting of the remaining elements of this stream after discarding the first n elements of the stream. If this stream contains fewer than n elements then an empty stream will be returned.
Note : LongStream skip() is a stateful intermediate operation i.e, it may incorporate state from previously seen elements when processing new elements.
LongStream skip(long n)
Parameter : LongStream is a sequence of primitive long-valued elements. This is the long primitive specialization of Stream. n is the number of leading elements to skip.
Return Value : The function returns the new stream after discarding first n elements.
Exception : The function throws IllegalArgumentException if n is negative.
Example 1 :
Example 2 :
- DoubleStream skip() in Java
- IntStream skip() in Java
- LongStream sum() in Java
- LongStream of() in Java
- LongStream limit() in Java
- LongStream max() in Java with examples
- LongStream min() in Java with examples
- LongStream iterator() in Java
- LongStream findFirst() in Java
- LongStream concat() in Java
- LongStream summaryStatistics() in Java
- LongStream sorted() in Java
- LongStream sequential() in Java
- LongStream range() in Java
- LongStream rangeClosed() in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.