Here you can find the source of stream(final Iterator
public static <T> Stream<T> stream(final Iterator<T> iterator)
//package com.java2s; //License from project: Open Source License import java.util.*; import java.util.stream.Stream; import java.util.stream.StreamSupport; public class Main { public static <T> Stream<T> stream(final Iterable<T> iterable) { return StreamSupport.stream(iterable.spliterator(), false); }/*from ww w. j ava2s . co m*/ public static <T> Stream<T> stream(final Iterator<T> iterator) { return stream(() -> iterator); } }