Java SE API
Stream.skip()
Drops up to n initial elements in encounter order if present. Java SE API; example uses Java 21-compatible syntax.
Formal Syntax & Structure
java syntaxjava
Stream<T> skip(long n)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| n | long | Nonnegative skip count |
Return Value
Stream<T>
Drops up to n initial elements in encounter order if present.
Working Example
Example Snippetjava
import java.util.*;import java.util.stream.*;public class Main { public static void main(String[] args) { var result = Stream.of(9, 3, 5, 3, 1).distinct().sorted().skip(1).limit(2).toList(); System.out.println(result); }}