Java Stream Create asStream(Iterator iter)

Here you can find the source of asStream(Iterator iter)

Description

as Stream

License

Open Source License

Declaration

public static final <T> Stream<T> asStream(Iterator<T> iter) 

Method Source Code

//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);
    }
}

Related

  1. asStream(Collection source, boolean parallel)
  2. asStream(Iterable sourceIterable)
  3. asStream(Iterator sourceIterator)
  4. asStream(T... objs)
  5. asStream(T[] items)