Here you can find the source of streamToList(Stream
public static <T> ArrayList<T> streamToList(Stream<T> stream)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.stream.Collectors; import java.util.stream.Stream; public class Main { public static <T> ArrayList<T> streamToList(Stream<T> stream) { return (ArrayList<T>) stream.collect(Collectors.toList()); }/* w w w .ja va 2 s. co m*/ }