Generate 'chunked' and 'windowed' signatures and delegating implementations

Add implementations of windowed.
This commit is contained in:
Ilya Gorbunov
2017-04-27 16:35:05 +03:00
parent 6ae85f5108
commit a3a1c391cc
13 changed files with 351 additions and 1 deletions
@@ -898,6 +898,12 @@ public expect fun <T : Any> Iterable<T?>.requireNoNulls(): Iterable<T>
*/
public expect fun <T : Any> List<T?>.requireNoNulls(): List<T>
@SinceKotlin("1.2")
public expect fun <T> Iterable<T>.chunked(size: Int): List<List<T>>
@SinceKotlin("1.2")
public expect fun <T, R> Iterable<T>.chunked(size: Int, transform: (List<T>) -> R): List<R>
/**
* Returns a list containing all elements of the original collection without the first occurrence of the given [element].
*/
@@ -989,6 +995,12 @@ public expect inline fun <T> Iterable<T>.plusElement(element: T): List<T>
@kotlin.internal.InlineOnly
public expect inline fun <T> Collection<T>.plusElement(element: T): List<T>
@SinceKotlin("1.2")
public expect fun <T> Iterable<T>.windowed(size: Int, step: Int): List<List<T>>
@SinceKotlin("1.2")
public expect fun <T, R> Iterable<T>.windowed(size: Int, step: Int, transform: (List<T>) -> R): List<R>
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/