DoubleStream builder() method in Java

Java 8Object Oriented ProgrammingProgramming

The builder() method of the DoubleStream class returns a builder for a DoubleStream.

The syntax is as follows −

static DoubleStream.Builder builder()

To use the DoubleStream class in Java, import the following package −

import java.util.stream.DoubleStream;

The following is an example to implement DoubleStream builder() method in Java −

Example

 Live Demo

import java.util.stream.Stream;
import java.util.stream.DoubleStream;

public class Demo {
   public static void main(String[] args) {
      DoubleStream doubleStream = DoubleStream.builder().add(15.9).build();
      doubleStream.forEach(System.out::println);
   }
}

Output

15.9
raja
Published on 28-Mar-2019 06:24:40
Advertisements