Java Streams - DoubleStream empty() example








DoubleStream empty() returns an empty sequential DoubleStream.

Syntax

empty has the following syntax.

static DoubleStream empty()

Example

The following example shows how to use empty.

import java.util.stream.DoubleStream;

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

The code above generates the following result.