Here you can find the source of stream(Iterable input)
public static <S> Stream<S> stream(Iterable<S> input)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; import java.util.stream.Stream; import java.util.stream.StreamSupport; public class Main { public static <S> Stream<S> stream(Iterator<S> input) { return stream(input, false); }/*w w w . j a v a2 s . c o m*/ private static <S> Stream<S> stream(Iterator<S> input, boolean parallel) { Iterable<S> it = () -> input; return StreamSupport.stream(it.spliterator(), parallel); } public static <S> Stream<S> stream(Iterable<S> input) { return stream(input, false); } private static <S> Stream<S> stream(Iterable<S> input, boolean parallel) { return StreamSupport.stream(input.spliterator(), parallel); } }