Generate 'chunked' and 'windowed' signatures and delegating implementations
Add implementations of windowed.
This commit is contained in:
@@ -1788,6 +1788,16 @@ public fun <T : Any> List<T?>.requireNoNulls(): List<T> {
|
||||
return this as List<T>
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T> Iterable<T>.chunked(size: Int): List<List<T>> {
|
||||
return chunked(size) { it.toList() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T, R> Iterable<T>.chunked(size: Int, transform: (List<T>) -> R): List<R> {
|
||||
return windowed(size, size, transform)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list containing all elements of the original collection without the first occurrence of the given [element].
|
||||
*/
|
||||
@@ -1976,6 +1986,19 @@ public inline fun <T> Collection<T>.plusElement(element: T): List<T> {
|
||||
return plus(element)
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T> Iterable<T>.windowed(size: Int, step: Int): List<List<T>> {
|
||||
return windowed(size, step) { it.toList() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T, R> Iterable<T>.windowed(size: Int, step: Int, transform: (List<T>) -> R): List<R> {
|
||||
if (this is List) {
|
||||
return windowIndices(this.size, size, step, dropTrailing = false).asIterable().map { transform(subList(it.start, it.endInclusive + 1)) }
|
||||
}
|
||||
return windowForwardOnlySequenceImpl(iterator(), size, step, dropTrailing = false).asIterable().map(transform)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
||||
*/
|
||||
|
||||
@@ -1309,6 +1309,16 @@ public fun <T : Any> Sequence<T?>.requireNoNulls(): Sequence<T> {
|
||||
return map { it ?: throw IllegalArgumentException("null element found in $this.") }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T> Sequence<T>.chunked(size: Int): Sequence<List<T>> {
|
||||
return chunked(size) { it.toList() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T, R> Sequence<T>.chunked(size: Int, transform: (List<T>) -> R): Sequence<R> {
|
||||
return windowed(size, size, transform)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sequence containing all elements of the original sequence without the first occurrence of the given [element].
|
||||
*
|
||||
@@ -1485,6 +1495,16 @@ public inline fun <T> Sequence<T>.plusElement(element: T): Sequence<T> {
|
||||
return plus(element)
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T> Sequence<T>.windowed(size: Int, step: Int): Sequence<List<T>> {
|
||||
return windowed(size, step) { it.toList() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T, R> Sequence<T>.windowed(size: Int, step: Int, transform: (List<T>) -> R): Sequence<R> {
|
||||
return Sequence { windowForwardOnlySequenceImpl(iterator(), size, step, dropTrailing = false).iterator() }.map(transform)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sequence of pairs built from elements of both sequences with same indexes.
|
||||
* Resulting sequence has length of shortest input sequence.
|
||||
|
||||
@@ -1102,6 +1102,26 @@ public inline fun CharSequence.sumByDouble(selector: (Char) -> Double): Double {
|
||||
return sum
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun CharSequence.chunked(size: Int): List<String> {
|
||||
return chunked(size) { it.toString() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <R> CharSequence.chunked(size: Int, transform: (CharSequence) -> R): List<R> {
|
||||
return windowed(size, size, transform)
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun CharSequence.chunkedSequence(size: Int): Sequence<String> {
|
||||
return chunkedSequence(size) { it.toString() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <R> CharSequence.chunkedSequence(size: Int, transform: (CharSequence) -> R): Sequence<R> {
|
||||
return windowedSequence(size, size, transform)
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun CharSequence.pairwise(): List<Pair<Char, Char>> {
|
||||
return pairwise { a, b -> a to b }
|
||||
@@ -1154,6 +1174,26 @@ public inline fun String.partition(predicate: (Char) -> Boolean): Pair<String, S
|
||||
return Pair(first.toString(), second.toString())
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun CharSequence.windowed(size: Int, step: Int): List<String> {
|
||||
return windowed(size, step) { it.toString() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <R> CharSequence.windowed(size: Int, step: Int, transform: (CharSequence) -> R): List<R> {
|
||||
return windowIndices(this.length, size, step, dropTrailing = false).asIterable().map { transform(subSequence(it)) }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun CharSequence.windowedSequence(size: Int, step: Int): Sequence<String> {
|
||||
return windowedSequence(size, step) { it.toString() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <R> CharSequence.windowedSequence(size: Int, step: Int, transform: (CharSequence) -> R): Sequence<R> {
|
||||
return windowIndices(this.length, size, step, dropTrailing = false).map { transform(subSequence(it)) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of pairs built from characters of both char sequences with same indexes. List has length of shortest char sequence.
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -803,6 +803,12 @@ public expect inline fun <T> Sequence<T>.sumByDouble(selector: (T) -> Double): D
|
||||
*/
|
||||
public expect fun <T : Any> Sequence<T?>.requireNoNulls(): Sequence<T>
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public expect fun <T> Sequence<T>.chunked(size: Int): Sequence<List<T>>
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public expect fun <T, R> Sequence<T>.chunked(size: Int, transform: (List<T>) -> R): Sequence<R>
|
||||
|
||||
/**
|
||||
* Returns a sequence containing all elements of the original sequence without the first occurrence of the given [element].
|
||||
*
|
||||
@@ -908,6 +914,12 @@ public expect operator fun <T> Sequence<T>.plus(elements: Sequence<T>): Sequence
|
||||
@kotlin.internal.InlineOnly
|
||||
public expect inline fun <T> Sequence<T>.plusElement(element: T): Sequence<T>
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public expect fun <T> Sequence<T>.windowed(size: Int, step: Int): Sequence<List<T>>
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public expect fun <T, R> Sequence<T>.windowed(size: Int, step: Int, transform: (List<T>) -> R): Sequence<R>
|
||||
|
||||
/**
|
||||
* Returns a sequence of pairs built from elements of both sequences with same indexes.
|
||||
* Resulting sequence has length of shortest input sequence.
|
||||
|
||||
@@ -638,6 +638,18 @@ public expect inline fun CharSequence.sumBy(selector: (Char) -> Int): Int
|
||||
*/
|
||||
public expect inline fun CharSequence.sumByDouble(selector: (Char) -> Double): Double
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public expect fun CharSequence.chunked(size: Int): List<String>
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public expect fun <R> CharSequence.chunked(size: Int, transform: (CharSequence) -> R): List<R>
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public expect fun CharSequence.chunkedSequence(size: Int): Sequence<String>
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public expect fun <R> CharSequence.chunkedSequence(size: Int, transform: (CharSequence) -> R): Sequence<R>
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public expect fun CharSequence.pairwise(): List<Pair<Char, Char>>
|
||||
|
||||
@@ -658,6 +670,18 @@ public expect inline fun CharSequence.partition(predicate: (Char) -> Boolean): P
|
||||
*/
|
||||
public expect inline fun String.partition(predicate: (Char) -> Boolean): Pair<String, String>
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public expect fun CharSequence.windowed(size: Int, step: Int): List<String>
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public expect fun <R> CharSequence.windowed(size: Int, step: Int, transform: (CharSequence) -> R): List<R>
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public expect fun CharSequence.windowedSequence(size: Int, step: Int): Sequence<String>
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public expect fun <R> CharSequence.windowedSequence(size: Int, step: Int, transform: (CharSequence) -> R): Sequence<R>
|
||||
|
||||
/**
|
||||
* Returns a list of pairs built from characters of both char sequences with same indexes. List has length of shortest char sequence.
|
||||
*/
|
||||
|
||||
@@ -1798,6 +1798,16 @@ public fun <T : Any> List<T?>.requireNoNulls(): List<T> {
|
||||
return this as List<T>
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T> Iterable<T>.chunked(size: Int): List<List<T>> {
|
||||
return chunked(size) { it.toList() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T, R> Iterable<T>.chunked(size: Int, transform: (List<T>) -> R): List<R> {
|
||||
return windowed(size, size, transform)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list containing all elements of the original collection without the first occurrence of the given [element].
|
||||
*/
|
||||
@@ -1986,6 +1996,19 @@ public inline fun <T> Collection<T>.plusElement(element: T): List<T> {
|
||||
return plus(element)
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T> Iterable<T>.windowed(size: Int, step: Int): List<List<T>> {
|
||||
return windowed(size, step) { it.toList() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T, R> Iterable<T>.windowed(size: Int, step: Int, transform: (List<T>) -> R): List<R> {
|
||||
if (this is List) {
|
||||
return windowIndices(this.size, size, step, dropTrailing = false).asIterable().map { transform(subList(it.start, it.endInclusive + 1)) }
|
||||
}
|
||||
return windowForwardOnlySequenceImpl(iterator(), size, step, dropTrailing = false).asIterable().map(transform)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
||||
*/
|
||||
|
||||
@@ -1331,6 +1331,16 @@ public fun <T : Any> Sequence<T?>.requireNoNulls(): Sequence<T> {
|
||||
return map { it ?: throw IllegalArgumentException("null element found in $this.") }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T> Sequence<T>.chunked(size: Int): Sequence<List<T>> {
|
||||
return chunked(size) { it.toList() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T, R> Sequence<T>.chunked(size: Int, transform: (List<T>) -> R): Sequence<R> {
|
||||
return windowed(size, size, transform)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sequence containing all elements of the original sequence without the first occurrence of the given [element].
|
||||
*
|
||||
@@ -1507,6 +1517,16 @@ public inline fun <T> Sequence<T>.plusElement(element: T): Sequence<T> {
|
||||
return plus(element)
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T> Sequence<T>.windowed(size: Int, step: Int): Sequence<List<T>> {
|
||||
return windowed(size, step) { it.toList() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T, R> Sequence<T>.windowed(size: Int, step: Int, transform: (List<T>) -> R): Sequence<R> {
|
||||
return Sequence { windowForwardOnlySequenceImpl(iterator(), size, step, dropTrailing = false).iterator() }.map(transform)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sequence of pairs built from elements of both sequences with same indexes.
|
||||
* Resulting sequence has length of shortest input sequence.
|
||||
|
||||
@@ -1110,6 +1110,26 @@ public inline fun CharSequence.sumByDouble(selector: (Char) -> Double): Double {
|
||||
return sum
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun CharSequence.chunked(size: Int): List<String> {
|
||||
return chunked(size) { it.toString() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <R> CharSequence.chunked(size: Int, transform: (CharSequence) -> R): List<R> {
|
||||
return windowed(size, size, transform)
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun CharSequence.chunkedSequence(size: Int): Sequence<String> {
|
||||
return chunkedSequence(size) { it.toString() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <R> CharSequence.chunkedSequence(size: Int, transform: (CharSequence) -> R): Sequence<R> {
|
||||
return windowedSequence(size, size, transform)
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun CharSequence.pairwise(): List<Pair<Char, Char>> {
|
||||
return pairwise { a, b -> a to b }
|
||||
@@ -1162,6 +1182,26 @@ public inline fun String.partition(predicate: (Char) -> Boolean): Pair<String, S
|
||||
return Pair(first.toString(), second.toString())
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun CharSequence.windowed(size: Int, step: Int): List<String> {
|
||||
return windowed(size, step) { it.toString() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <R> CharSequence.windowed(size: Int, step: Int, transform: (CharSequence) -> R): List<R> {
|
||||
return windowIndices(this.length, size, step, dropTrailing = false).asIterable().map { transform(subSequence(it)) }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun CharSequence.windowedSequence(size: Int, step: Int): Sequence<String> {
|
||||
return windowedSequence(size, step) { it.toString() }
|
||||
}
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
public fun <R> CharSequence.windowedSequence(size: Int, step: Int, transform: (CharSequence) -> R): Sequence<R> {
|
||||
return windowIndices(this.length, size, step, dropTrailing = false).map { transform(subSequence(it)) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of pairs built from characters of both char sequences with same indexes. List has length of shortest char sequence.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
+16
@@ -1565,6 +1565,8 @@ public final class kotlin/collections/CollectionsKt {
|
||||
public static synthetic fun binarySearch$default (Ljava/util/List;Ljava/lang/Object;Ljava/util/Comparator;IIILjava/lang/Object;)I
|
||||
public static final fun binarySearchBy (Ljava/util/List;Ljava/lang/Comparable;IILkotlin/jvm/functions/Function1;)I
|
||||
public static synthetic fun binarySearchBy$default (Ljava/util/List;Ljava/lang/Comparable;IILkotlin/jvm/functions/Function1;ILjava/lang/Object;)I
|
||||
public static final fun chunked (Ljava/lang/Iterable;I)Ljava/util/List;
|
||||
public static final fun chunked (Ljava/lang/Iterable;ILkotlin/jvm/functions/Function1;)Ljava/util/List;
|
||||
public static final fun collectionSizeOrDefault (Ljava/lang/Iterable;I)I
|
||||
public static final fun collectionSizeOrNull (Ljava/lang/Iterable;)Ljava/lang/Integer;
|
||||
public static final fun contains (Ljava/lang/Iterable;Ljava/lang/Object;)Z
|
||||
@@ -1745,6 +1747,8 @@ public final class kotlin/collections/CollectionsKt {
|
||||
public static final fun toSortedSet (Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/SortedSet;
|
||||
public static final fun union (Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
|
||||
public static final fun unzip (Ljava/lang/Iterable;)Lkotlin/Pair;
|
||||
public static final fun windowed (Ljava/lang/Iterable;II)Ljava/util/List;
|
||||
public static final fun windowed (Ljava/lang/Iterable;IILkotlin/jvm/functions/Function1;)Ljava/util/List;
|
||||
public static final fun withIndex (Ljava/lang/Iterable;)Ljava/lang/Iterable;
|
||||
public static final fun withIndex (Ljava/util/Iterator;)Ljava/util/Iterator;
|
||||
public static final fun zip (Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/List;
|
||||
@@ -3474,6 +3478,8 @@ public final class kotlin/sequences/SequencesKt {
|
||||
public static final fun averageOfInt (Lkotlin/sequences/Sequence;)D
|
||||
public static final fun averageOfLong (Lkotlin/sequences/Sequence;)D
|
||||
public static final fun averageOfShort (Lkotlin/sequences/Sequence;)D
|
||||
public static final fun chunked (Lkotlin/sequences/Sequence;I)Lkotlin/sequences/Sequence;
|
||||
public static final fun chunked (Lkotlin/sequences/Sequence;ILkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
|
||||
public static final fun constrainOnce (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;
|
||||
public static final fun contains (Lkotlin/sequences/Sequence;Ljava/lang/Object;)Z
|
||||
public static final fun count (Lkotlin/sequences/Sequence;)I
|
||||
@@ -3592,6 +3598,8 @@ public final class kotlin/sequences/SequencesKt {
|
||||
public static final fun toSortedSet (Lkotlin/sequences/Sequence;)Ljava/util/SortedSet;
|
||||
public static final fun toSortedSet (Lkotlin/sequences/Sequence;Ljava/util/Comparator;)Ljava/util/SortedSet;
|
||||
public static final fun unzip (Lkotlin/sequences/Sequence;)Lkotlin/Pair;
|
||||
public static final fun windowed (Lkotlin/sequences/Sequence;II)Lkotlin/sequences/Sequence;
|
||||
public static final fun windowed (Lkotlin/sequences/Sequence;IILkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
|
||||
public static final fun withIndex (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;
|
||||
public static final fun zip (Lkotlin/sequences/Sequence;Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;
|
||||
public static final fun zip (Lkotlin/sequences/Sequence;Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;
|
||||
@@ -3800,6 +3808,10 @@ public final class kotlin/text/StringsKt {
|
||||
public static final fun associateByTo (Ljava/lang/CharSequence;Ljava/util/Map;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/util/Map;
|
||||
public static final fun associateTo (Ljava/lang/CharSequence;Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Ljava/util/Map;
|
||||
public static final fun capitalize (Ljava/lang/String;)Ljava/lang/String;
|
||||
public static final fun chunked (Ljava/lang/CharSequence;I)Ljava/util/List;
|
||||
public static final fun chunked (Ljava/lang/CharSequence;ILkotlin/jvm/functions/Function1;)Ljava/util/List;
|
||||
public static final fun chunkedSequence (Ljava/lang/CharSequence;I)Lkotlin/sequences/Sequence;
|
||||
public static final fun chunkedSequence (Ljava/lang/CharSequence;ILkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
|
||||
public static final fun commonPrefixWith (Ljava/lang/CharSequence;Ljava/lang/CharSequence;Z)Ljava/lang/String;
|
||||
public static synthetic fun commonPrefixWith$default (Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Ljava/lang/String;
|
||||
public static final fun commonSuffixWith (Ljava/lang/CharSequence;Ljava/lang/CharSequence;Z)Ljava/lang/String;
|
||||
@@ -4060,6 +4072,10 @@ public final class kotlin/text/StringsKt {
|
||||
public static final fun trimStart (Ljava/lang/CharSequence;[C)Ljava/lang/CharSequence;
|
||||
public static final fun trimStart (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Ljava/lang/String;
|
||||
public static final fun trimStart (Ljava/lang/String;[C)Ljava/lang/String;
|
||||
public static final fun windowed (Ljava/lang/CharSequence;II)Ljava/util/List;
|
||||
public static final fun windowed (Ljava/lang/CharSequence;IILkotlin/jvm/functions/Function1;)Ljava/util/List;
|
||||
public static final fun windowedSequence (Ljava/lang/CharSequence;II)Lkotlin/sequences/Sequence;
|
||||
public static final fun windowedSequence (Ljava/lang/CharSequence;IILkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
|
||||
public static final fun withIndex (Ljava/lang/CharSequence;)Ljava/lang/Iterable;
|
||||
public static final fun zip (Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/util/List;
|
||||
public static final fun zip (Ljava/lang/CharSequence;Ljava/lang/CharSequence;Lkotlin/jvm/functions/Function2;)Ljava/util/List;
|
||||
|
||||
@@ -1424,6 +1424,8 @@ public final class kotlin/collections/CollectionsKt {
|
||||
public static synthetic fun binarySearch$default (Ljava/util/List;Ljava/lang/Object;Ljava/util/Comparator;IIILjava/lang/Object;)I
|
||||
public static final fun binarySearchBy (Ljava/util/List;Ljava/lang/Comparable;IILkotlin/jvm/functions/Function1;)I
|
||||
public static synthetic fun binarySearchBy$default (Ljava/util/List;Ljava/lang/Comparable;IILkotlin/jvm/functions/Function1;ILjava/lang/Object;)I
|
||||
public static final fun chunked (Ljava/lang/Iterable;I)Ljava/util/List;
|
||||
public static final fun chunked (Ljava/lang/Iterable;ILkotlin/jvm/functions/Function1;)Ljava/util/List;
|
||||
public static final fun collectionSizeOrDefault (Ljava/lang/Iterable;I)I
|
||||
public static final fun collectionSizeOrNull (Ljava/lang/Iterable;)Ljava/lang/Integer;
|
||||
public static final fun contains (Ljava/lang/Iterable;Ljava/lang/Object;)Z
|
||||
@@ -1604,6 +1606,8 @@ public final class kotlin/collections/CollectionsKt {
|
||||
public static final fun toSortedSet (Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/SortedSet;
|
||||
public static final fun union (Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
|
||||
public static final fun unzip (Ljava/lang/Iterable;)Lkotlin/Pair;
|
||||
public static final fun windowed (Ljava/lang/Iterable;II)Ljava/util/List;
|
||||
public static final fun windowed (Ljava/lang/Iterable;IILkotlin/jvm/functions/Function1;)Ljava/util/List;
|
||||
public static final fun withIndex (Ljava/lang/Iterable;)Ljava/lang/Iterable;
|
||||
public static final fun withIndex (Ljava/util/Iterator;)Ljava/util/Iterator;
|
||||
public static final fun zip (Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/List;
|
||||
@@ -2169,6 +2173,8 @@ public final class kotlin/sequences/SequencesKt {
|
||||
public static final fun averageOfInt (Lkotlin/sequences/Sequence;)D
|
||||
public static final fun averageOfLong (Lkotlin/sequences/Sequence;)D
|
||||
public static final fun averageOfShort (Lkotlin/sequences/Sequence;)D
|
||||
public static final fun chunked (Lkotlin/sequences/Sequence;I)Lkotlin/sequences/Sequence;
|
||||
public static final fun chunked (Lkotlin/sequences/Sequence;ILkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
|
||||
public static final fun constrainOnce (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;
|
||||
public static final fun contains (Lkotlin/sequences/Sequence;Ljava/lang/Object;)Z
|
||||
public static final fun count (Lkotlin/sequences/Sequence;)I
|
||||
@@ -2287,6 +2293,8 @@ public final class kotlin/sequences/SequencesKt {
|
||||
public static final fun toSortedSet (Lkotlin/sequences/Sequence;)Ljava/util/SortedSet;
|
||||
public static final fun toSortedSet (Lkotlin/sequences/Sequence;Ljava/util/Comparator;)Ljava/util/SortedSet;
|
||||
public static final fun unzip (Lkotlin/sequences/Sequence;)Lkotlin/Pair;
|
||||
public static final fun windowed (Lkotlin/sequences/Sequence;II)Lkotlin/sequences/Sequence;
|
||||
public static final fun windowed (Lkotlin/sequences/Sequence;IILkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
|
||||
public static final fun withIndex (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;
|
||||
public static final fun zip (Lkotlin/sequences/Sequence;Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;
|
||||
public static final fun zip (Lkotlin/sequences/Sequence;Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;
|
||||
@@ -2495,6 +2503,10 @@ public final class kotlin/text/StringsKt {
|
||||
public static final fun associateByTo (Ljava/lang/CharSequence;Ljava/util/Map;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/util/Map;
|
||||
public static final fun associateTo (Ljava/lang/CharSequence;Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Ljava/util/Map;
|
||||
public static final fun capitalize (Ljava/lang/String;)Ljava/lang/String;
|
||||
public static final fun chunked (Ljava/lang/CharSequence;I)Ljava/util/List;
|
||||
public static final fun chunked (Ljava/lang/CharSequence;ILkotlin/jvm/functions/Function1;)Ljava/util/List;
|
||||
public static final fun chunkedSequence (Ljava/lang/CharSequence;I)Lkotlin/sequences/Sequence;
|
||||
public static final fun chunkedSequence (Ljava/lang/CharSequence;ILkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
|
||||
public static final fun commonPrefixWith (Ljava/lang/CharSequence;Ljava/lang/CharSequence;Z)Ljava/lang/String;
|
||||
public static synthetic fun commonPrefixWith$default (Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Ljava/lang/String;
|
||||
public static final fun commonSuffixWith (Ljava/lang/CharSequence;Ljava/lang/CharSequence;Z)Ljava/lang/String;
|
||||
@@ -2755,6 +2767,10 @@ public final class kotlin/text/StringsKt {
|
||||
public static final fun trimStart (Ljava/lang/CharSequence;[C)Ljava/lang/CharSequence;
|
||||
public static final fun trimStart (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Ljava/lang/String;
|
||||
public static final fun trimStart (Ljava/lang/String;[C)Ljava/lang/String;
|
||||
public static final fun windowed (Ljava/lang/CharSequence;II)Ljava/util/List;
|
||||
public static final fun windowed (Ljava/lang/CharSequence;IILkotlin/jvm/functions/Function1;)Ljava/util/List;
|
||||
public static final fun windowedSequence (Ljava/lang/CharSequence;II)Lkotlin/sequences/Sequence;
|
||||
public static final fun windowedSequence (Ljava/lang/CharSequence;IILkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
|
||||
public static final fun withIndex (Ljava/lang/CharSequence;)Ljava/lang/Iterable;
|
||||
public static final fun zip (Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/util/List;
|
||||
public static final fun zip (Ljava/lang/CharSequence;Ljava/lang/CharSequence;Lkotlin/jvm/functions/Function2;)Ljava/util/List;
|
||||
|
||||
@@ -559,6 +559,110 @@ fun generators(): List<GenericFunction> {
|
||||
}
|
||||
}
|
||||
|
||||
templates add f("windowed(size: Int, step: Int, transform: (List<T>) -> R)") {
|
||||
since("1.2")
|
||||
only(Iterables, Sequences, CharSequences)
|
||||
typeParam("R")
|
||||
|
||||
returns("List<R>")
|
||||
|
||||
body {
|
||||
"""
|
||||
if (this is List) {
|
||||
return windowIndices(this.size, size, step, dropTrailing = false).asIterable().map { transform(subList(it.start, it.endInclusive + 1)) }
|
||||
}
|
||||
return windowForwardOnlySequenceImpl(iterator(), size, step, dropTrailing = false).asIterable().map(transform)
|
||||
"""
|
||||
}
|
||||
|
||||
customSignature(CharSequences) { "windowed(size: Int, step: Int, transform: (CharSequence) -> R)" }
|
||||
body(CharSequences) {
|
||||
"""
|
||||
return windowIndices(this.length, size, step, dropTrailing = false).asIterable().map { transform(subSequence(it)) }
|
||||
"""
|
||||
}
|
||||
|
||||
returns(Sequences) { "Sequence<R>" }
|
||||
body(Sequences) {
|
||||
"""
|
||||
return Sequence { windowForwardOnlySequenceImpl(iterator(), size, step, dropTrailing = false).iterator() }.map(transform)
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
templates add f("windowed(size: Int, step: Int)") {
|
||||
since("1.2")
|
||||
only(Iterables, Sequences, CharSequences)
|
||||
returns(Iterables) { "List<List<T>>" }
|
||||
returns(Sequences) { "Sequence<List<T>>" }
|
||||
returns(CharSequences) { "List<String>" }
|
||||
|
||||
body { "return windowed(size, step) { it.toList() }" }
|
||||
body(CharSequences) { "return windowed(size, step) { it.toString() }" }
|
||||
}
|
||||
|
||||
templates add f("windowedSequence(size: Int, step: Int, transform: (CharSequence) -> R)") {
|
||||
since("1.2")
|
||||
only(CharSequences)
|
||||
typeParam("R")
|
||||
returns { "Sequence<R> "}
|
||||
|
||||
body(CharSequences) {
|
||||
"""
|
||||
return windowIndices(this.length, size, step, dropTrailing = false).map { transform(subSequence(it)) }
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
templates add f("windowedSequence(size: Int, step: Int)") {
|
||||
since("1.2")
|
||||
only(CharSequences)
|
||||
returns { "Sequence<String> "}
|
||||
|
||||
body(CharSequences) { "return windowedSequence(size, step) { it.toString() }" }
|
||||
}
|
||||
|
||||
templates add f("chunked(size: Int, transform: (List<T>) -> R)") {
|
||||
since("1.2")
|
||||
only(Iterables, Sequences, CharSequences)
|
||||
typeParam("R")
|
||||
|
||||
returns("List<R>")
|
||||
|
||||
customSignature(CharSequences) { "chunked(size: Int, transform: (CharSequence) -> R)" }
|
||||
|
||||
returns(Sequences) { "Sequence<R>" }
|
||||
body { "return windowed(size, size, transform)" }
|
||||
}
|
||||
|
||||
templates add f("chunked(size: Int)") {
|
||||
since("1.2")
|
||||
only(Iterables, Sequences, CharSequences)
|
||||
returns(Iterables) { "List<List<T>>" }
|
||||
returns(Sequences) { "Sequence<List<T>>" }
|
||||
returns(CharSequences) { "List<String>" }
|
||||
|
||||
body { "return chunked(size) { it.toList() }" }
|
||||
body(CharSequences) { "return chunked(size) { it.toString() }" }
|
||||
}
|
||||
|
||||
templates add f("chunkedSequence(size: Int, transform: (CharSequence) -> R)") {
|
||||
since("1.2")
|
||||
only(CharSequences)
|
||||
typeParam("R")
|
||||
returns { "Sequence<R> "}
|
||||
|
||||
body { "return windowedSequence(size, size, transform)" }
|
||||
}
|
||||
|
||||
templates add f("chunkedSequence(size: Int)") {
|
||||
since("1.2")
|
||||
only(CharSequences)
|
||||
returns { "Sequence<String> "}
|
||||
|
||||
body(CharSequences) { "return chunkedSequence(size) { it.toString() }" }
|
||||
}
|
||||
|
||||
templates add f("pairwise(transform: (a: T, b: T) -> R)") {
|
||||
since("1.2")
|
||||
only(Iterables, Sequences, CharSequences)
|
||||
|
||||
Reference in New Issue
Block a user