Here you can find the source of asStream(Iterator
public static final <T> Stream<T> asStream(Iterator<T> iter)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; import java.util.Spliterators; import java.util.stream.Stream; import java.util.stream.StreamSupport; public class Main { public static final <T> Stream<T> asStream(Iterator<T> iter) { return asStream(iter, false); }/*from www .ja v a 2 s. c om*/ public static final <T> Stream<T> asStream(Iterator<T> iter, boolean parallel) { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iter, 0), parallel); } public static final <T> Stream<T> asStream(Iterator<T> iter, int characteristics, boolean parallel) { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iter, characteristics), parallel); } }