bookmark

java - Java8 Iterator to Stream - Stack Overflow


Description

public static <T> Stream<T> asStream(Iterator<T> sourceIterator, boolean parallel) {
    Iterable<T> iterable = () -> sourceIterator;
    return StreamSupport.stream(iterable.spliterator(), parallel);
}

Preview

Tags

Users

  • @jil

Comments and Reviews