Thomas
03/19/2024, 1:50 AMIterator
producer, instead of a simple function that takes a single Iterator
?Thomas
03/19/2024, 1:57 AM/**
* Given an [iterator] function constructs an [Iterable] instance that returns values through the [Iterator]
* provided by that function.
* @sample samples.collections.Iterables.Building.iterable
*/
@kotlin.internal.InlineOnly
public inline fun <T> Iterable(crossinline iterator: () -> Iterator<T>): Iterable<T> = object : Iterable<T> {
override fun iterator(): Iterator<T> = iterator()
}
Thomas
03/19/2024, 1:59 AMpublic fun <T> Iterable(iterator: Iterator<T>): Iterable<T> = object : Iterable<T> {
override fun iterator(): Iterator<T> = iterator
}
Thomas
03/19/2024, 2:00 AMjw
03/19/2024, 2:13 AMThomas
03/19/2024, 2:14 AM