Example usage for java.util.stream IntStream collect

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

Introduction

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

Prototype

<R> R collect(Supplier<R> supplier, ObjIntConsumer<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) {
    IntStream i = IntStream.of(6, 5, 7, 1, 2, 3, 3);
    List<Integer> v = i.collect(ArrayList::new, ArrayList::add, ArrayList::addAll);

    System.out.println(v);/* w  ww  .j a  v  a  2  s.  com*/
}