DoubleStream of(double t) example

Description

DoubleStream of(double t) creates a sequential DoubleStream containing a single element.

Syntax

of has the following syntax.


static DoubleStream of(double t)

Example

The following example shows how to use of.


import java.util.stream.DoubleStream;
//from ww w.  ja v  a2s  .  c  om
public class Main {
  public static void main(String[] args) {
    DoubleStream d = DoubleStream.of(1.2);
    
    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