Provide asIterable for sequences.

This commit is contained in:
Ilya Gorbunov
2015-07-27 18:43:12 +03:00
parent 6f71e54268
commit 0f5c3678f8
@@ -47,6 +47,15 @@ public fun <T> sequenceOf(progression: Progression<T>): Sequence<T> = object : S
override fun iterator(): Iterator<T> = progression.iterator()
}
/**
* Returns an [Iterable] instance that wraps the original sequence.
*/
public fun <T> Sequence<T>.asIterable(): Iterable<T> {
return object : Iterable<T> {
override fun iterator(): Iterator<T> = this@asIterable.iterator()
}
}
/**
* Returns an empty sequence.
*/