Here you can find the source of toStream(final Iterable
public static <T> Stream<T> toStream(final Iterable<T> iterable)
//package com.java2s; //License from project: Apache License import java.util.*; import java.util.stream.Stream; public class Main { public static <T> Stream<T> toStream(final Iterable<T> iterable) { return toList(iterable).stream(); }/*ww w. ja va 2 s . co m*/ public static <T> List<T> toList(final Iterable<T> iterable) { List<T> list = new ArrayList<>(); for (final T item : iterable) { list.add(item); } return list; } }