Here you can find the source of toStream(Collection
private static <T> Stream<T> toStream(Collection<T> collection)
//package com.java2s; //License from project: Apache License import java.util.Collection; import java.util.stream.Stream; public class Main { private static <T> Stream<T> toStream(Collection<T> collection) { if (collection == null) { return Stream.empty(); } else {/*from w w w.ja v a2 s . c o m*/ return collection.stream(); } } }