DoubleStream.Builder build() example

Description

DoubleStream.Builder build() builds the stream, transitioning this builder to the built state.

Syntax

build has the following syntax.


DoubleStream build()

Example

The following example shows how to use build.


import java.util.stream.DoubleStream;
/*w ww. j ava  2s. c  o m*/
public class Main {
  public static void main(String[] args) {
    DoubleStream.Builder b = DoubleStream.builder();
    b.accept(1.1);
    b.accept(2.2);
    b.accept(3.3);
    b.accept(4.4);
    
    b.build().forEach(System.out::println);
  }
}

The code above generates the following result.





















Home »
  Java Streams »
    Reference »




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