Class StreamSupport

java.lang.Object
java.util.stream.StreamSupport

public final class StreamSupport extends Object

Makes a Stream of a Spliterator: what Collection.stream() does, and how a library turns any Iterable into a stream (StreamSupport.stream(iterable.spliterator(), false)).

Streams here run sequentially; parallel is what isParallel() reports and changes nothing else, which the JDK allows.

  • Method Details

    • stream

      public static <T> Stream<T> stream(Spliterator<T> spliterator, boolean parallel)
      The elements of spliterator, read when a terminal operation asks for them.
    • stream

      public static <T> Stream<T> stream(Supplier<? extends Spliterator<T>> supplier, int characteristics, boolean parallel)
      The elements of the spliterator supplier answers when a terminal operation first asks for one.