public class Streams
extends java.lang.Object
| Constructor and Description |
|---|
Streams() |
| Modifier and Type | Method and Description |
|---|---|
static <T> io.vavr.collection.Stream<T> |
iterate(java.util.function.Supplier<? extends io.vavr.control.Option<? extends T>> supplier)
Generates a (theoretically) infinitely long Stream using a repeatedly invoked supplier
that provides a
Some for each next value and a None for the end. |
static <T> io.vavr.collection.Stream<T> |
iterate(T seed,
java.util.function.Function<? super T,? extends io.vavr.control.Option<? extends T>> fn)
Generates a (theoretically) infinitely long Stream using a function to calculate the next value
based on the previous.
|
public static <T> io.vavr.collection.Stream<T> iterate(java.util.function.Supplier<? extends io.vavr.control.Option<? extends T>> supplier)
Some for each next value and a None for the end.
The Supplier will be invoked only that many times until it returns None,
and repeated iteration over the stream will produce the same values in the same order,
without any further invocations to the Supplier.T - value typesupplier - A Supplier of iterator valuespublic static <T> io.vavr.collection.Stream<T> iterate(T seed,
java.util.function.Function<? super T,? extends io.vavr.control.Option<? extends T>> fn)
T - value typeseed - The first value in the Streamfn - A function to calculate the next value based on the previous