public class StreamUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> Stream<T> |
stream(Iterator<T> iterator)
Convert iterator to stream.
|
static <T> Stream<T> |
stream(Supplier<Boolean> hasNext,
Supplier<T> next)
Consider using
Stream.generate(Supplier) followed by Stream.limit(long)
in case the element count is know in advance. |
public static <T> Stream<T> stream(Iterator<T> iterator)
iterator - The iterator whose elements are converted to streampublic static <T> Stream<T> stream(Supplier<Boolean> hasNext, Supplier<T> next)
Stream.generate(Supplier) followed by Stream.limit(long)
in case the element count is know in advance.hasNext - The hasNext suppliernext - The value supplierCopyright © 2015. All rights reserved.