Java Streams - IntStream empty() example








IntStream empty() returns an empty sequential IntStream.

Syntax

empty has the following syntax.

static IntStream empty()

Example

The following example shows how to use empty.

import java.util.stream.IntStream;

public class Main {
  public static void main(String[] args) {
    IntStream i = IntStream.empty();
    System.out.println(i.count());
  }
}

The code above generates the following result.