Here you can find the source of lazyStream(PrimitiveIterator.OfLong iterator)
Parameter | Description |
---|---|
iterator | Iterator to use |
public static LongStream lazyStream(PrimitiveIterator.OfLong iterator)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; import java.util.PrimitiveIterator; import java.util.stream.LongStream; import java.util.stream.Stream; import static java.util.Spliterator.IMMUTABLE; import static java.util.Spliterator.NONNULL; import static java.util.Spliterators.spliteratorUnknownSize; import static java.util.stream.StreamSupport.longStream; import static java.util.stream.StreamSupport.stream; public class Main { /**//w w w. j av a 2 s . c o m * Utility Method to create a stream from an iterator. Elements are added lazily. * * @param iterator Iterator to use * @return A long stream with the iterated longs */ public static LongStream lazyStream(PrimitiveIterator.OfLong iterator) { return longStream(spliteratorUnknownSize(iterator, IMMUTABLE | NONNULL), false); } /** * Utility Method to create a stream from an iterator. Elements are added lazily. * * @param iterator Iterator to use * @return A stream with the iterated objects */ public static <E> Stream<E> lazyStream(Iterator<E> iterator) { return stream(spliteratorUnknownSize(iterator, IMMUTABLE | NONNULL), false); } }