kotlin.sequences.generateSequence
generateSequence
fun <T : Any> generateSequence( nextFunction: () -> T? ): Sequence<T>
Returns a sequence which invokes the function to calculate the next value on each iteration until the function returns null
.
The returned sequence is constrained to be iterated only once.
See Also
fun <T : Any> generateSequence( seed: T?, nextFunction: (T) -> T? ): Sequence<T>