LongStream empty() example

Description

LongStream empty() returns an empty sequential LongStream.

Syntax

empty has the following syntax.


static LongStream empty()

Example

The following example shows how to use empty.


import java.util.stream.LongStream;
/*from   www  .j a v a 2s .c o m*/
public class Main {
  public static void main(String[] args) {
    LongStream b = LongStream.empty();

    System.out.println(b.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