Here you can find the source of streamOf (final Iterable extends T> iterable)
public static <T> Stream<T> streamOf (final Iterable<? extends T> iterable)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file import java.util.Iterator; import java.util.Spliterators; import java.util.stream.Stream; import java.util.stream.StreamSupport; public class Main { /** Wrap an iterable in a stream */ public static <T> Stream<T> streamOf( final Iterable<? extends T> iterable) { return streamOf(iterable.iterator()); }//from www . j a va 2 s. com /** Wrap an iterator in a stream */ public static <T> Stream<T> streamOf( final Iterator<? extends T> iterator) { return StreamSupport.stream( Spliterators.spliteratorUnknownSize(iterator, 0), false); } }