IntStream empty() example

Description

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;
//from ww w  .ja  v a  2  s.c  o m
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.





















Home »
  Java Streams »
    Reference »




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