IntStream skip(long n) example

Description

IntStream skip(long n) returns a stream by discarding the first n elements of the stream.

Syntax

skip has the following syntax.


IntStream skip(long n)

Example

The following example shows how to use skip.


import java.util.stream.IntStream;
/*from   ww  w .  java2  s . com*/
public class Main {
  public static void main(String[] args) {
    IntStream i = IntStream.of(6,5,7,1, 2, 3, 4);
    i.skip(3)
     .forEach(System.out::println);
  }
}

The code above generates the following result.





















Home »
  Java Streams »
    Reference »




Collectors
DoubleStream
DoubleStream.Builder
IntStream
IntStream.Builder
LongStream
LongStream.Builder
Stream
Stream.Builder