IntStream 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 : IntStream skip() is a stateful intermediate operation i.e, it may incorporate state from previously seen elements when processing new elements.
IntStream skip(long n)
Parameter : IntStream is a sequence of primitive int-valued elements. This is the int 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 :
9 10 11
Example 2 :
10 11 9
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- LongStream skip() in Java
- DoubleStream skip() in Java
- Stream skip() method in Java with examples
- PushbackInputStream skip() method in Java with Examples
- Scanner skip() method in Java with Examples
- ByteArrayInputStream skip() method in Java with Examples
- PushbackReader skip(long) method in Java with Examples
- BufferedReader skip(long) method in Java with Examples
- Reader skip(long) method in Java with Examples
- BufferedInputStream skip(long) method in Java with Examples
- CharArrayReader skip(long) method in Java with Examples
- StringReader skip(long) method in Java with Examples
- IntStream of() in Java
- IntStream sum() in Java
- IntStream rangeClosed() in Java
- IntStream asLongStream() in Java
- IntStream range() in Java
- IntStream limit() in Java
- IntStream mapToObj() in Java
- IntStream boxed() 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 email@example.com. 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.