Java 8 Streams Java Java API
java.util.stream.LongStream
LongStream skip(long n)
This stateful intermediate operation 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.
n
package com.logicbig.example.longstream;import java.util.stream.LongStream;public class SkipExample { public static void main(String... args) { LongStream.of(4, 7, 9, 11, 13, 17) .skip(2) .forEach(System.out::println); }}
9111317
Parallel stream:
package com.logicbig.example.longstream;import java.util.stream.LongStream;public class SkipExample2 { public static void main(String... args) { LongStream.of(4, 7, 9, 11, 13, 17) .parallel() .skip(2) .forEach(System.out::println); }}
1113179