Java Stream of toParallelStream(Iterator iter)

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

Description

to Parallel Stream

License

Open Source License

Declaration

public static <T> Stream<T> toParallelStream(Iterator<T> iter) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Iterator;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

public class Main {
    public static <T> Stream<T> toParallelStream(Iterator<T> iter) {
        Spliterator<T> spliter = Spliterators.spliteratorUnknownSize(iter, Spliterator.NONNULL);

        return StreamSupport.stream(spliter, true);
    }// w  w w  . ja  v a  2  s  . c o m
}

Related

  1. streamOfEnumeration(Enumeration e, boolean parallel)
  2. streamOfOptional(Optional element)
  3. streamOrEmpty(Iterable iterable)
  4. streamScanner(Scanner scanner)
  5. streamToList(Stream stream)
  6. toStream(Collection collection)
  7. toStream(Enumeration e)
  8. toStream(final Iterable iterable)
  9. toStream(final Iterable iterable)