Example usage for java.util.stream DoubleStream collect

List of usage examples for java.util.stream DoubleStream collect

Introduction

In this page you can find the example usage for java.util.stream DoubleStream collect.

Prototype

<R> R collect(Supplier<R> supplier, ObjDoubleConsumer<R> accumulator, BiConsumer<R, R> combiner);

Source Link

Document

Performs a mutable reduction operation on the elements of this stream.

Usage

From source file:Main.java

public static void main(String[] args) {
    DoubleStream b = DoubleStream.of(1.1, 2.2, 3.3, 4.4, 5.5);

    List<Double> names = b.collect(ArrayList::new, ArrayList::add, ArrayList::addAll);

    System.out.println(names);/*from w  ww.  j a  v a2s  .  co  m*/

}