DoubleStream boxed() example

Description

DoubleStream boxed() returns a Stream boxed to Double. This is an intermediate operation.

Syntax

boxed has the following syntax.


Stream<Double> boxed()

Example

The following example shows how to use boxed.


import java.util.stream.DoubleStream;
import java.util.stream.Stream;
//from   w ww.  ja v a  2 s  .c  om
public class Main {
  public static void main(String[] args) {
    DoubleStream i = DoubleStream.of(1.0,2.0,3.3,4.4,5.5,6.6,7.7);
    Stream<Double> o =  i.boxed();
    
    o.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