Java Stream Operation iteratorToFiniteStream(Iterator iterator, boolean parallel)

Here you can find the source of iteratorToFiniteStream(Iterator iterator, boolean parallel)

Description

iterator To Finite Stream

License

Apache License

Declaration

static <T> Stream<T> iteratorToFiniteStream(Iterator<T> iterator, boolean parallel) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Iterator;

import java.util.stream.Stream;
import java.util.stream.StreamSupport;

public class Main {
    static <T> Stream<T> iteratorToFiniteStream(Iterator<T> iterator, boolean parallel) {
        final Iterable<T> iterable = () -> iterator;
        return StreamSupport.stream(iterable.spliterator(), parallel);
    }//  w w w. j  a  v a2 s. co m
}

Related

  1. infiniteParallelStream()
  2. interleave(Stream a, Stream b)
  3. isEmpty(final Stream stream)
  4. isFinite(Stream stream)
  5. iterableOf(Stream stream)
  6. iteratorToStream(final Iterator iterator)
  7. lazyPartition(final Stream stream, final int maxPartitionSize)
  8. lazyStream(PrimitiveIterator.OfLong iterator)
  9. longArray(Stream stream)