public class Iterators
extends java.lang.Object
| Constructor and Description |
|---|
Iterators() |
| Modifier and Type | Method and Description |
|---|---|
static <T> io.vavr.collection.Iterator<T> |
iterate(java.util.function.Supplier<? extends io.vavr.control.Option<? extends T>> supplier)
Creates an iterator that repeatedly invokes the supplier
while it's a
Some and end on the first None |
static <T> io.vavr.collection.Iterator<T> |
iterate(T seed,
java.util.function.Function<? super T,? extends io.vavr.control.Option<? extends T>> fn)
Generates an infinite iterator using a function to calculate the next value
based on the previous.
|
public static <T> io.vavr.collection.Iterator<T> iterate(java.util.function.Supplier<? extends io.vavr.control.Option<? extends T>> supplier)
Some and end on the first NoneT - value typesupplier - A Supplier of iterator valuesIteratorjava.lang.NullPointerException - if supplier produces null valuepublic static <T> io.vavr.collection.Iterator<T> iterate(T seed,
java.util.function.Function<? super T,? extends io.vavr.control.Option<? extends T>> fn)
Some
and stops on the first NoneT - value typeseed - The first value in the iteratorfn - A function to calculate the next value based on the previousIterator