DoubleStream of(double... values) example

Description

DoubleStream of(double... values) creates a sequential ordered stream whose elements are the specified values.

Syntax

of has the following syntax.


static DoubleStream of(double... values)

Example

The following example shows how to use of.


import java.util.stream.DoubleStream;
//  w  ww  . j a  va  2 s . com
public class Main {
  public static void main(String[] args) {
    DoubleStream d = DoubleStream.of(1.2,2.3,4.5);
    
    d.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