diff --git a/libraries/stdlib/src/generated/_Arrays.kt b/libraries/stdlib/src/generated/_Arrays.kt index 120c53ea71b..ec9a6aa6eef 100644 --- a/libraries/stdlib/src/generated/_Arrays.kt +++ b/libraries/stdlib/src/generated/_Arrays.kt @@ -373,63 +373,63 @@ public inline operator fun ShortArray.component5(): Short { } /** - * Returns `true` if [element] is found in the collection. + * Returns `true` if [element] is found in the array. */ public operator fun Array.contains(element: @kotlin.internal.NoInfer T): Boolean { return indexOf(element) >= 0 } /** - * Returns `true` if [element] is found in the collection. + * Returns `true` if [element] is found in the array. */ public operator fun BooleanArray.contains(element: Boolean): Boolean { return indexOf(element) >= 0 } /** - * Returns `true` if [element] is found in the collection. + * Returns `true` if [element] is found in the array. */ public operator fun ByteArray.contains(element: Byte): Boolean { return indexOf(element) >= 0 } /** - * Returns `true` if [element] is found in the collection. + * Returns `true` if [element] is found in the array. */ public operator fun CharArray.contains(element: Char): Boolean { return indexOf(element) >= 0 } /** - * Returns `true` if [element] is found in the collection. + * Returns `true` if [element] is found in the array. */ public operator fun DoubleArray.contains(element: Double): Boolean { return indexOf(element) >= 0 } /** - * Returns `true` if [element] is found in the collection. + * Returns `true` if [element] is found in the array. */ public operator fun FloatArray.contains(element: Float): Boolean { return indexOf(element) >= 0 } /** - * Returns `true` if [element] is found in the collection. + * Returns `true` if [element] is found in the array. */ public operator fun IntArray.contains(element: Int): Boolean { return indexOf(element) >= 0 } /** - * Returns `true` if [element] is found in the collection. + * Returns `true` if [element] is found in the array. */ public operator fun LongArray.contains(element: Long): Boolean { return indexOf(element) >= 0 } /** - * Returns `true` if [element] is found in the collection. + * Returns `true` if [element] is found in the array. */ public operator fun ShortArray.contains(element: Short): Boolean { return indexOf(element) >= 0 @@ -446,7 +446,7 @@ public operator fun Array.contains(element: T): Boolean { } /** - * Returns `true` if [element] is found in the collection. + * Returns `true` if [element] is found in the array. * Allows to overcome type-safety restriction of `contains` that requires to pass an element of type `T`. */ @Suppress("NOTHING_TO_INLINE") @@ -455,252 +455,252 @@ public inline fun Array.containsRaw(element: Any?): Boolean { } /** - * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array. */ public fun Array.elementAt(index: Int): T { return get(index) } /** - * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array. */ public fun BooleanArray.elementAt(index: Int): Boolean { return get(index) } /** - * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array. */ public fun ByteArray.elementAt(index: Int): Byte { return get(index) } /** - * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array. */ public fun CharArray.elementAt(index: Int): Char { return get(index) } /** - * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array. */ public fun DoubleArray.elementAt(index: Int): Double { return get(index) } /** - * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array. */ public fun FloatArray.elementAt(index: Int): Float { return get(index) } /** - * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array. */ public fun IntArray.elementAt(index: Int): Int { return get(index) } /** - * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array. */ public fun LongArray.elementAt(index: Int): Long { return get(index) } /** - * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array. */ public fun ShortArray.elementAt(index: Int): Short { return get(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun Array.elementAtOrElse(index: Int, defaultValue: (Int) -> T): T { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun BooleanArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Boolean): Boolean { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun ByteArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Byte): Byte { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun CharArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Char): Char { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun DoubleArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Double): Double { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun FloatArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Float): Float { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun IntArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Int): Int { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun LongArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Long): Long { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun ShortArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Short): Short { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun Array.elementAtOrNull(index: Int): T? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun BooleanArray.elementAtOrNull(index: Int): Boolean? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun ByteArray.elementAtOrNull(index: Int): Byte? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun CharArray.elementAtOrNull(index: Int): Char? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun DoubleArray.elementAtOrNull(index: Int): Double? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun FloatArray.elementAtOrNull(index: Int): Float? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun IntArray.elementAtOrNull(index: Int): Int? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun LongArray.elementAtOrNull(index: Int): Long? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun ShortArray.elementAtOrNull(index: Int): Short? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns the first element matching the given [predicate], or `null` if element was not found. + * Returns the first element matching the given [predicate], or `null` if no such element was found. */ public inline fun Array.find(predicate: (T) -> Boolean): T? { return firstOrNull(predicate) } /** - * Returns the first element matching the given [predicate], or `null` if element was not found. + * Returns the first element matching the given [predicate], or `null` if no such element was found. */ public inline fun BooleanArray.find(predicate: (Boolean) -> Boolean): Boolean? { return firstOrNull(predicate) } /** - * Returns the first element matching the given [predicate], or `null` if element was not found. + * Returns the first element matching the given [predicate], or `null` if no such element was found. */ public inline fun ByteArray.find(predicate: (Byte) -> Boolean): Byte? { return firstOrNull(predicate) } /** - * Returns the first element matching the given [predicate], or `null` if element was not found. + * Returns the first element matching the given [predicate], or `null` if no such element was found. */ public inline fun CharArray.find(predicate: (Char) -> Boolean): Char? { return firstOrNull(predicate) } /** - * Returns the first element matching the given [predicate], or `null` if element was not found. + * Returns the first element matching the given [predicate], or `null` if no such element was found. */ public inline fun DoubleArray.find(predicate: (Double) -> Boolean): Double? { return firstOrNull(predicate) } /** - * Returns the first element matching the given [predicate], or `null` if element was not found. + * Returns the first element matching the given [predicate], or `null` if no such element was found. */ public inline fun FloatArray.find(predicate: (Float) -> Boolean): Float? { return firstOrNull(predicate) } /** - * Returns the first element matching the given [predicate], or `null` if element was not found. + * Returns the first element matching the given [predicate], or `null` if no such element was found. */ public inline fun IntArray.find(predicate: (Int) -> Boolean): Int? { return firstOrNull(predicate) } /** - * Returns the first element matching the given [predicate], or `null` if element was not found. + * Returns the first element matching the given [predicate], or `null` if no such element was found. */ public inline fun LongArray.find(predicate: (Long) -> Boolean): Long? { return firstOrNull(predicate) } /** - * Returns the first element matching the given [predicate], or `null` if element was not found. + * Returns the first element matching the given [predicate], or `null` if no such element was found. */ public inline fun ShortArray.find(predicate: (Short) -> Boolean): Short? { return firstOrNull(predicate) @@ -771,7 +771,7 @@ public inline fun ShortArray.findLast(predicate: (Short) -> Boolean): Short? { /** * Returns first element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun Array.first(): T { if (isEmpty()) @@ -781,7 +781,7 @@ public fun Array.first(): T { /** * Returns first element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun BooleanArray.first(): Boolean { if (isEmpty()) @@ -791,7 +791,7 @@ public fun BooleanArray.first(): Boolean { /** * Returns first element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun ByteArray.first(): Byte { if (isEmpty()) @@ -801,7 +801,7 @@ public fun ByteArray.first(): Byte { /** * Returns first element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun CharArray.first(): Char { if (isEmpty()) @@ -811,7 +811,7 @@ public fun CharArray.first(): Char { /** * Returns first element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun DoubleArray.first(): Double { if (isEmpty()) @@ -821,7 +821,7 @@ public fun DoubleArray.first(): Double { /** * Returns first element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun FloatArray.first(): Float { if (isEmpty()) @@ -831,7 +831,7 @@ public fun FloatArray.first(): Float { /** * Returns first element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun IntArray.first(): Int { if (isEmpty()) @@ -841,7 +841,7 @@ public fun IntArray.first(): Int { /** * Returns first element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun LongArray.first(): Long { if (isEmpty()) @@ -851,7 +851,7 @@ public fun LongArray.first(): Long { /** * Returns first element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun ShortArray.first(): Short { if (isEmpty()) @@ -941,63 +941,63 @@ public inline fun ShortArray.first(predicate: (Short) -> Boolean): Short { } /** - * Returns the first element, or `null` if the collection is empty. + * Returns the first element, or `null` if the array is empty. */ public fun Array.firstOrNull(): T? { return if (isEmpty()) null else this[0] } /** - * Returns the first element, or `null` if the collection is empty. + * Returns the first element, or `null` if the array is empty. */ public fun BooleanArray.firstOrNull(): Boolean? { return if (isEmpty()) null else this[0] } /** - * Returns the first element, or `null` if the collection is empty. + * Returns the first element, or `null` if the array is empty. */ public fun ByteArray.firstOrNull(): Byte? { return if (isEmpty()) null else this[0] } /** - * Returns the first element, or `null` if the collection is empty. + * Returns the first element, or `null` if the array is empty. */ public fun CharArray.firstOrNull(): Char? { return if (isEmpty()) null else this[0] } /** - * Returns the first element, or `null` if the collection is empty. + * Returns the first element, or `null` if the array is empty. */ public fun DoubleArray.firstOrNull(): Double? { return if (isEmpty()) null else this[0] } /** - * Returns the first element, or `null` if the collection is empty. + * Returns the first element, or `null` if the array is empty. */ public fun FloatArray.firstOrNull(): Float? { return if (isEmpty()) null else this[0] } /** - * Returns the first element, or `null` if the collection is empty. + * Returns the first element, or `null` if the array is empty. */ public fun IntArray.firstOrNull(): Int? { return if (isEmpty()) null else this[0] } /** - * Returns the first element, or `null` if the collection is empty. + * Returns the first element, or `null` if the array is empty. */ public fun LongArray.firstOrNull(): Long? { return if (isEmpty()) null else this[0] } /** - * Returns the first element, or `null` if the collection is empty. + * Returns the first element, or `null` if the array is empty. */ public fun ShortArray.firstOrNull(): Short? { return if (isEmpty()) null else this[0] @@ -1076,133 +1076,133 @@ public inline fun ShortArray.firstOrNull(predicate: (Short) -> Boolean): Short? } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun Array.getOrElse(index: Int, defaultValue: (Int) -> T): T { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun BooleanArray.getOrElse(index: Int, defaultValue: (Int) -> Boolean): Boolean { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun ByteArray.getOrElse(index: Int, defaultValue: (Int) -> Byte): Byte { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun CharArray.getOrElse(index: Int, defaultValue: (Int) -> Char): Char { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun DoubleArray.getOrElse(index: Int, defaultValue: (Int) -> Double): Double { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun FloatArray.getOrElse(index: Int, defaultValue: (Int) -> Float): Float { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun IntArray.getOrElse(index: Int, defaultValue: (Int) -> Int): Int { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun LongArray.getOrElse(index: Int, defaultValue: (Int) -> Long): Long { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array. */ public inline fun ShortArray.getOrElse(index: Int, defaultValue: (Int) -> Short): Short { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun Array.getOrNull(index: Int): T? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun BooleanArray.getOrNull(index: Int): Boolean? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun ByteArray.getOrNull(index: Int): Byte? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun CharArray.getOrNull(index: Int): Char? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun DoubleArray.getOrNull(index: Int): Double? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun FloatArray.getOrNull(index: Int): Float? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun IntArray.getOrNull(index: Int): Int? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun LongArray.getOrNull(index: Int): Long? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array. */ public fun ShortArray.getOrNull(index: Int): Short? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns first index of [element], or -1 if the collection does not contain element. + * Returns first index of [element], or -1 if the array does not contain element. */ public fun Array.indexOf(element: @kotlin.internal.NoInfer T): Int { if (element == null) { @@ -1222,7 +1222,7 @@ public fun Array.indexOf(element: @kotlin.internal.NoInfer T): Int { } /** - * Returns first index of [element], or -1 if the collection does not contain element. + * Returns first index of [element], or -1 if the array does not contain element. */ public fun BooleanArray.indexOf(element: Boolean): Int { for (index in indices) { @@ -1234,7 +1234,7 @@ public fun BooleanArray.indexOf(element: Boolean): Int { } /** - * Returns first index of [element], or -1 if the collection does not contain element. + * Returns first index of [element], or -1 if the array does not contain element. */ public fun ByteArray.indexOf(element: Byte): Int { for (index in indices) { @@ -1246,7 +1246,7 @@ public fun ByteArray.indexOf(element: Byte): Int { } /** - * Returns first index of [element], or -1 if the collection does not contain element. + * Returns first index of [element], or -1 if the array does not contain element. */ public fun CharArray.indexOf(element: Char): Int { for (index in indices) { @@ -1258,7 +1258,7 @@ public fun CharArray.indexOf(element: Char): Int { } /** - * Returns first index of [element], or -1 if the collection does not contain element. + * Returns first index of [element], or -1 if the array does not contain element. */ public fun DoubleArray.indexOf(element: Double): Int { for (index in indices) { @@ -1270,7 +1270,7 @@ public fun DoubleArray.indexOf(element: Double): Int { } /** - * Returns first index of [element], or -1 if the collection does not contain element. + * Returns first index of [element], or -1 if the array does not contain element. */ public fun FloatArray.indexOf(element: Float): Int { for (index in indices) { @@ -1282,7 +1282,7 @@ public fun FloatArray.indexOf(element: Float): Int { } /** - * Returns first index of [element], or -1 if the collection does not contain element. + * Returns first index of [element], or -1 if the array does not contain element. */ public fun IntArray.indexOf(element: Int): Int { for (index in indices) { @@ -1294,7 +1294,7 @@ public fun IntArray.indexOf(element: Int): Int { } /** - * Returns first index of [element], or -1 if the collection does not contain element. + * Returns first index of [element], or -1 if the array does not contain element. */ public fun LongArray.indexOf(element: Long): Int { for (index in indices) { @@ -1306,7 +1306,7 @@ public fun LongArray.indexOf(element: Long): Int { } /** - * Returns first index of [element], or -1 if the collection does not contain element. + * Returns first index of [element], or -1 if the array does not contain element. */ public fun ShortArray.indexOf(element: Short): Int { for (index in indices) { @@ -1329,7 +1329,7 @@ public fun Array.indexOf(element: T): Int { } /** - * Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun Array.indexOfFirst(predicate: (T) -> Boolean): Int { for (index in indices) { @@ -1341,7 +1341,7 @@ public inline fun Array.indexOfFirst(predicate: (T) -> Boolean): Int } /** - * Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun BooleanArray.indexOfFirst(predicate: (Boolean) -> Boolean): Int { for (index in indices) { @@ -1353,7 +1353,7 @@ public inline fun BooleanArray.indexOfFirst(predicate: (Boolean) -> Boolean): In } /** - * Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun ByteArray.indexOfFirst(predicate: (Byte) -> Boolean): Int { for (index in indices) { @@ -1365,7 +1365,7 @@ public inline fun ByteArray.indexOfFirst(predicate: (Byte) -> Boolean): Int { } /** - * Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun CharArray.indexOfFirst(predicate: (Char) -> Boolean): Int { for (index in indices) { @@ -1377,7 +1377,7 @@ public inline fun CharArray.indexOfFirst(predicate: (Char) -> Boolean): Int { } /** - * Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun DoubleArray.indexOfFirst(predicate: (Double) -> Boolean): Int { for (index in indices) { @@ -1389,7 +1389,7 @@ public inline fun DoubleArray.indexOfFirst(predicate: (Double) -> Boolean): Int } /** - * Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun FloatArray.indexOfFirst(predicate: (Float) -> Boolean): Int { for (index in indices) { @@ -1401,7 +1401,7 @@ public inline fun FloatArray.indexOfFirst(predicate: (Float) -> Boolean): Int { } /** - * Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun IntArray.indexOfFirst(predicate: (Int) -> Boolean): Int { for (index in indices) { @@ -1413,7 +1413,7 @@ public inline fun IntArray.indexOfFirst(predicate: (Int) -> Boolean): Int { } /** - * Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun LongArray.indexOfFirst(predicate: (Long) -> Boolean): Int { for (index in indices) { @@ -1425,7 +1425,7 @@ public inline fun LongArray.indexOfFirst(predicate: (Long) -> Boolean): Int { } /** - * Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun ShortArray.indexOfFirst(predicate: (Short) -> Boolean): Int { for (index in indices) { @@ -1437,7 +1437,7 @@ public inline fun ShortArray.indexOfFirst(predicate: (Short) -> Boolean): Int { } /** - * Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun Array.indexOfLast(predicate: (T) -> Boolean): Int { for (index in indices.reversed()) { @@ -1449,7 +1449,7 @@ public inline fun Array.indexOfLast(predicate: (T) -> Boolean): Int { } /** - * Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun BooleanArray.indexOfLast(predicate: (Boolean) -> Boolean): Int { for (index in indices.reversed()) { @@ -1461,7 +1461,7 @@ public inline fun BooleanArray.indexOfLast(predicate: (Boolean) -> Boolean): Int } /** - * Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun ByteArray.indexOfLast(predicate: (Byte) -> Boolean): Int { for (index in indices.reversed()) { @@ -1473,7 +1473,7 @@ public inline fun ByteArray.indexOfLast(predicate: (Byte) -> Boolean): Int { } /** - * Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun CharArray.indexOfLast(predicate: (Char) -> Boolean): Int { for (index in indices.reversed()) { @@ -1485,7 +1485,7 @@ public inline fun CharArray.indexOfLast(predicate: (Char) -> Boolean): Int { } /** - * Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun DoubleArray.indexOfLast(predicate: (Double) -> Boolean): Int { for (index in indices.reversed()) { @@ -1497,7 +1497,7 @@ public inline fun DoubleArray.indexOfLast(predicate: (Double) -> Boolean): Int { } /** - * Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun FloatArray.indexOfLast(predicate: (Float) -> Boolean): Int { for (index in indices.reversed()) { @@ -1509,7 +1509,7 @@ public inline fun FloatArray.indexOfLast(predicate: (Float) -> Boolean): Int { } /** - * Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun IntArray.indexOfLast(predicate: (Int) -> Boolean): Int { for (index in indices.reversed()) { @@ -1521,7 +1521,7 @@ public inline fun IntArray.indexOfLast(predicate: (Int) -> Boolean): Int { } /** - * Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun LongArray.indexOfLast(predicate: (Long) -> Boolean): Int { for (index in indices.reversed()) { @@ -1533,7 +1533,7 @@ public inline fun LongArray.indexOfLast(predicate: (Long) -> Boolean): Int { } /** - * Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element. */ public inline fun ShortArray.indexOfLast(predicate: (Short) -> Boolean): Int { for (index in indices.reversed()) { @@ -1545,7 +1545,7 @@ public inline fun ShortArray.indexOfLast(predicate: (Short) -> Boolean): Int { } /** - * Returns first index of [element], or -1 if the collection does not contain element. + * Returns first index of [element], or -1 if the array does not contain element. * Allows to overcome type-safety restriction of `indexOf` that requires to pass an element of type `T`. */ @Suppress("NOTHING_TO_INLINE") @@ -1555,7 +1555,7 @@ public inline fun Array.indexOfRaw(element: Any?): Int { /** * Returns the last element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun Array.last(): T { if (isEmpty()) @@ -1565,7 +1565,7 @@ public fun Array.last(): T { /** * Returns the last element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun BooleanArray.last(): Boolean { if (isEmpty()) @@ -1575,7 +1575,7 @@ public fun BooleanArray.last(): Boolean { /** * Returns the last element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun ByteArray.last(): Byte { if (isEmpty()) @@ -1585,7 +1585,7 @@ public fun ByteArray.last(): Byte { /** * Returns the last element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun CharArray.last(): Char { if (isEmpty()) @@ -1595,7 +1595,7 @@ public fun CharArray.last(): Char { /** * Returns the last element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun DoubleArray.last(): Double { if (isEmpty()) @@ -1605,7 +1605,7 @@ public fun DoubleArray.last(): Double { /** * Returns the last element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun FloatArray.last(): Float { if (isEmpty()) @@ -1615,7 +1615,7 @@ public fun FloatArray.last(): Float { /** * Returns the last element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun IntArray.last(): Int { if (isEmpty()) @@ -1625,7 +1625,7 @@ public fun IntArray.last(): Int { /** * Returns the last element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun LongArray.last(): Long { if (isEmpty()) @@ -1635,7 +1635,7 @@ public fun LongArray.last(): Long { /** * Returns the last element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the array is empty. */ public fun ShortArray.last(): Short { if (isEmpty()) @@ -1752,7 +1752,7 @@ public inline fun ShortArray.last(predicate: (Short) -> Boolean): Short { } /** - * Returns last index of [element], or -1 if the collection does not contain element. + * Returns last index of [element], or -1 if the array does not contain element. */ public fun Array.lastIndexOf(element: @kotlin.internal.NoInfer T): Int { if (element == null) { @@ -1772,7 +1772,7 @@ public fun Array.lastIndexOf(element: @kotlin.internal.NoInfer T): In } /** - * Returns last index of [element], or -1 if the collection does not contain element. + * Returns last index of [element], or -1 if the array does not contain element. */ public fun BooleanArray.lastIndexOf(element: Boolean): Int { for (index in indices.reversed()) { @@ -1784,7 +1784,7 @@ public fun BooleanArray.lastIndexOf(element: Boolean): Int { } /** - * Returns last index of [element], or -1 if the collection does not contain element. + * Returns last index of [element], or -1 if the array does not contain element. */ public fun ByteArray.lastIndexOf(element: Byte): Int { for (index in indices.reversed()) { @@ -1796,7 +1796,7 @@ public fun ByteArray.lastIndexOf(element: Byte): Int { } /** - * Returns last index of [element], or -1 if the collection does not contain element. + * Returns last index of [element], or -1 if the array does not contain element. */ public fun CharArray.lastIndexOf(element: Char): Int { for (index in indices.reversed()) { @@ -1808,7 +1808,7 @@ public fun CharArray.lastIndexOf(element: Char): Int { } /** - * Returns last index of [element], or -1 if the collection does not contain element. + * Returns last index of [element], or -1 if the array does not contain element. */ public fun DoubleArray.lastIndexOf(element: Double): Int { for (index in indices.reversed()) { @@ -1820,7 +1820,7 @@ public fun DoubleArray.lastIndexOf(element: Double): Int { } /** - * Returns last index of [element], or -1 if the collection does not contain element. + * Returns last index of [element], or -1 if the array does not contain element. */ public fun FloatArray.lastIndexOf(element: Float): Int { for (index in indices.reversed()) { @@ -1832,7 +1832,7 @@ public fun FloatArray.lastIndexOf(element: Float): Int { } /** - * Returns last index of [element], or -1 if the collection does not contain element. + * Returns last index of [element], or -1 if the array does not contain element. */ public fun IntArray.lastIndexOf(element: Int): Int { for (index in indices.reversed()) { @@ -1844,7 +1844,7 @@ public fun IntArray.lastIndexOf(element: Int): Int { } /** - * Returns last index of [element], or -1 if the collection does not contain element. + * Returns last index of [element], or -1 if the array does not contain element. */ public fun LongArray.lastIndexOf(element: Long): Int { for (index in indices.reversed()) { @@ -1856,7 +1856,7 @@ public fun LongArray.lastIndexOf(element: Long): Int { } /** - * Returns last index of [element], or -1 if the collection does not contain element. + * Returns last index of [element], or -1 if the array does not contain element. */ public fun ShortArray.lastIndexOf(element: Short): Int { for (index in indices.reversed()) { @@ -1879,7 +1879,7 @@ public fun Array.lastIndexOf(element: T): Int { } /** - * Returns last index of [element], or -1 if the collection does not contain element. + * Returns last index of [element], or -1 if the array does not contain element. * Allows to overcome type-safety restriction of `lastIndexOf` that requires to pass an element of type `T`. */ @Suppress("NOTHING_TO_INLINE") @@ -1888,63 +1888,63 @@ public inline fun Array.lastIndexOfRaw(element: Any?): Int { } /** - * Returns the last element, or `null` if the collection is empty. + * Returns the last element, or `null` if the array is empty. */ public fun Array.lastOrNull(): T? { return if (isEmpty()) null else this[size() - 1] } /** - * Returns the last element, or `null` if the collection is empty. + * Returns the last element, or `null` if the array is empty. */ public fun BooleanArray.lastOrNull(): Boolean? { return if (isEmpty()) null else this[size() - 1] } /** - * Returns the last element, or `null` if the collection is empty. + * Returns the last element, or `null` if the array is empty. */ public fun ByteArray.lastOrNull(): Byte? { return if (isEmpty()) null else this[size() - 1] } /** - * Returns the last element, or `null` if the collection is empty. + * Returns the last element, or `null` if the array is empty. */ public fun CharArray.lastOrNull(): Char? { return if (isEmpty()) null else this[size() - 1] } /** - * Returns the last element, or `null` if the collection is empty. + * Returns the last element, or `null` if the array is empty. */ public fun DoubleArray.lastOrNull(): Double? { return if (isEmpty()) null else this[size() - 1] } /** - * Returns the last element, or `null` if the collection is empty. + * Returns the last element, or `null` if the array is empty. */ public fun FloatArray.lastOrNull(): Float? { return if (isEmpty()) null else this[size() - 1] } /** - * Returns the last element, or `null` if the collection is empty. + * Returns the last element, or `null` if the array is empty. */ public fun IntArray.lastOrNull(): Int? { return if (isEmpty()) null else this[size() - 1] } /** - * Returns the last element, or `null` if the collection is empty. + * Returns the last element, or `null` if the array is empty. */ public fun LongArray.lastOrNull(): Long? { return if (isEmpty()) null else this[size() - 1] } /** - * Returns the last element, or `null` if the collection is empty. + * Returns the last element, or `null` if the array is empty. */ public fun ShortArray.lastOrNull(): Short? { return if (isEmpty()) null else this[size() - 1] @@ -2050,7 +2050,7 @@ public inline fun ShortArray.lastOrNull(predicate: (Short) -> Boolean): Short? { } /** - * Returns the single element, or throws an exception if the collection is empty or has more than one element. + * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun Array.single(): T { return when (size()) { @@ -2061,7 +2061,7 @@ public fun Array.single(): T { } /** - * Returns the single element, or throws an exception if the collection is empty or has more than one element. + * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun BooleanArray.single(): Boolean { return when (size()) { @@ -2072,7 +2072,7 @@ public fun BooleanArray.single(): Boolean { } /** - * Returns the single element, or throws an exception if the collection is empty or has more than one element. + * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun ByteArray.single(): Byte { return when (size()) { @@ -2083,7 +2083,7 @@ public fun ByteArray.single(): Byte { } /** - * Returns the single element, or throws an exception if the collection is empty or has more than one element. + * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun CharArray.single(): Char { return when (size()) { @@ -2094,7 +2094,7 @@ public fun CharArray.single(): Char { } /** - * Returns the single element, or throws an exception if the collection is empty or has more than one element. + * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun DoubleArray.single(): Double { return when (size()) { @@ -2105,7 +2105,7 @@ public fun DoubleArray.single(): Double { } /** - * Returns the single element, or throws an exception if the collection is empty or has more than one element. + * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun FloatArray.single(): Float { return when (size()) { @@ -2116,7 +2116,7 @@ public fun FloatArray.single(): Float { } /** - * Returns the single element, or throws an exception if the collection is empty or has more than one element. + * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun IntArray.single(): Int { return when (size()) { @@ -2127,7 +2127,7 @@ public fun IntArray.single(): Int { } /** - * Returns the single element, or throws an exception if the collection is empty or has more than one element. + * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun LongArray.single(): Long { return when (size()) { @@ -2138,7 +2138,7 @@ public fun LongArray.single(): Long { } /** - * Returns the single element, or throws an exception if the collection is empty or has more than one element. + * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun ShortArray.single(): Short { return when (size()) { @@ -2302,63 +2302,63 @@ public inline fun ShortArray.single(predicate: (Short) -> Boolean): Short { } /** - * Returns single element, or `null` if the collection is empty or has more than one element. + * Returns single element, or `null` if the array is empty or has more than one element. */ public fun Array.singleOrNull(): T? { return if (size() == 1) this[0] else null } /** - * Returns single element, or `null` if the collection is empty or has more than one element. + * Returns single element, or `null` if the array is empty or has more than one element. */ public fun BooleanArray.singleOrNull(): Boolean? { return if (size() == 1) this[0] else null } /** - * Returns single element, or `null` if the collection is empty or has more than one element. + * Returns single element, or `null` if the array is empty or has more than one element. */ public fun ByteArray.singleOrNull(): Byte? { return if (size() == 1) this[0] else null } /** - * Returns single element, or `null` if the collection is empty or has more than one element. + * Returns single element, or `null` if the array is empty or has more than one element. */ public fun CharArray.singleOrNull(): Char? { return if (size() == 1) this[0] else null } /** - * Returns single element, or `null` if the collection is empty or has more than one element. + * Returns single element, or `null` if the array is empty or has more than one element. */ public fun DoubleArray.singleOrNull(): Double? { return if (size() == 1) this[0] else null } /** - * Returns single element, or `null` if the collection is empty or has more than one element. + * Returns single element, or `null` if the array is empty or has more than one element. */ public fun FloatArray.singleOrNull(): Float? { return if (size() == 1) this[0] else null } /** - * Returns single element, or `null` if the collection is empty or has more than one element. + * Returns single element, or `null` if the array is empty or has more than one element. */ public fun IntArray.singleOrNull(): Int? { return if (size() == 1) this[0] else null } /** - * Returns single element, or `null` if the collection is empty or has more than one element. + * Returns single element, or `null` if the array is empty or has more than one element. */ public fun LongArray.singleOrNull(): Long? { return if (size() == 1) this[0] else null } /** - * Returns single element, or `null` if the collection is empty or has more than one element. + * Returns single element, or `null` if the array is empty or has more than one element. */ public fun ShortArray.singleOrNull(): Short? { return if (size() == 1) this[0] else null @@ -5628,7 +5628,7 @@ public inline fun ShortArray.toMap(selector: (Short) -> K): Map { } /** - * Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection. + * Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to elements of the given array. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun Array.toMap(selector: (T) -> K, transform: (T) -> V): Map { @@ -5641,7 +5641,7 @@ public inline fun Array.toMap(selector: (T) -> K, transform: (T } /** - * Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection. + * Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to elements of the given array. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun BooleanArray.toMap(selector: (Boolean) -> K, transform: (Boolean) -> V): Map { @@ -5654,7 +5654,7 @@ public inline fun BooleanArray.toMap(selector: (Boolean) -> K, transform: } /** - * Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection. + * Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to elements of the given array. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun ByteArray.toMap(selector: (Byte) -> K, transform: (Byte) -> V): Map { @@ -5667,7 +5667,7 @@ public inline fun ByteArray.toMap(selector: (Byte) -> K, transform: (Byte } /** - * Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection. + * Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to elements of the given array. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun CharArray.toMap(selector: (Char) -> K, transform: (Char) -> V): Map { @@ -5680,7 +5680,7 @@ public inline fun CharArray.toMap(selector: (Char) -> K, transform: (Char } /** - * Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection. + * Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to elements of the given array. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun DoubleArray.toMap(selector: (Double) -> K, transform: (Double) -> V): Map { @@ -5693,7 +5693,7 @@ public inline fun DoubleArray.toMap(selector: (Double) -> K, transform: ( } /** - * Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection. + * Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to elements of the given array. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun FloatArray.toMap(selector: (Float) -> K, transform: (Float) -> V): Map { @@ -5706,7 +5706,7 @@ public inline fun FloatArray.toMap(selector: (Float) -> K, transform: (Fl } /** - * Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection. + * Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to elements of the given array. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun IntArray.toMap(selector: (Int) -> K, transform: (Int) -> V): Map { @@ -5719,7 +5719,7 @@ public inline fun IntArray.toMap(selector: (Int) -> K, transform: (Int) - } /** - * Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection. + * Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to elements of the given array. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun LongArray.toMap(selector: (Long) -> K, transform: (Long) -> V): Map { @@ -5732,7 +5732,7 @@ public inline fun LongArray.toMap(selector: (Long) -> K, transform: (Long } /** - * Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection. + * Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to elements of the given array. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun ShortArray.toMap(selector: (Short) -> K, transform: (Short) -> V): Map { @@ -5745,7 +5745,8 @@ public inline fun ShortArray.toMap(selector: (Short) -> K, transform: (Sh } /** - * Returns Map containing the values from the given collection indexed by [selector]. + * Returns Map containing the elements from the given array indexed by the key + * returned from [selector] function applied to each element. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun Array.toMapBy(selector: (T) -> K): Map { @@ -5758,7 +5759,8 @@ public inline fun Array.toMapBy(selector: (T) -> K): Map { } /** - * Returns Map containing the values from the given collection indexed by [selector]. + * Returns Map containing the elements from the given array indexed by the key + * returned from [selector] function applied to each element. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun BooleanArray.toMapBy(selector: (Boolean) -> K): Map { @@ -5771,7 +5773,8 @@ public inline fun BooleanArray.toMapBy(selector: (Boolean) -> K): Map ByteArray.toMapBy(selector: (Byte) -> K): Map { @@ -5784,7 +5787,8 @@ public inline fun ByteArray.toMapBy(selector: (Byte) -> K): Map { } /** - * Returns Map containing the values from the given collection indexed by [selector]. + * Returns Map containing the elements from the given array indexed by the key + * returned from [selector] function applied to each element. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun CharArray.toMapBy(selector: (Char) -> K): Map { @@ -5797,7 +5801,8 @@ public inline fun CharArray.toMapBy(selector: (Char) -> K): Map { } /** - * Returns Map containing the values from the given collection indexed by [selector]. + * Returns Map containing the elements from the given array indexed by the key + * returned from [selector] function applied to each element. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun DoubleArray.toMapBy(selector: (Double) -> K): Map { @@ -5810,7 +5815,8 @@ public inline fun DoubleArray.toMapBy(selector: (Double) -> K): Map FloatArray.toMapBy(selector: (Float) -> K): Map { @@ -5823,7 +5829,8 @@ public inline fun FloatArray.toMapBy(selector: (Float) -> K): Map } /** - * Returns Map containing the values from the given collection indexed by [selector]. + * Returns Map containing the elements from the given array indexed by the key + * returned from [selector] function applied to each element. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun IntArray.toMapBy(selector: (Int) -> K): Map { @@ -5836,7 +5843,8 @@ public inline fun IntArray.toMapBy(selector: (Int) -> K): Map { } /** - * Returns Map containing the values from the given collection indexed by [selector]. + * Returns Map containing the elements from the given array indexed by the key + * returned from [selector] function applied to each element. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun LongArray.toMapBy(selector: (Long) -> K): Map { @@ -5849,7 +5857,8 @@ public inline fun LongArray.toMapBy(selector: (Long) -> K): Map { } /** - * Returns Map containing the values from the given collection indexed by [selector]. + * Returns Map containing the elements from the given array indexed by the key + * returned from [selector] function applied to each element. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun ShortArray.toMapBy(selector: (Short) -> K): Map { @@ -5988,70 +5997,70 @@ public fun ShortArray.toSortedSet(): SortedSet { } /** - * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection. + * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array. */ public inline fun Array.flatMap(transform: (T) -> Iterable): List { return flatMapTo(ArrayList(), transform) } /** - * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection. + * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array. */ public inline fun BooleanArray.flatMap(transform: (Boolean) -> Iterable): List { return flatMapTo(ArrayList(), transform) } /** - * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection. + * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array. */ public inline fun ByteArray.flatMap(transform: (Byte) -> Iterable): List { return flatMapTo(ArrayList(), transform) } /** - * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection. + * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array. */ public inline fun CharArray.flatMap(transform: (Char) -> Iterable): List { return flatMapTo(ArrayList(), transform) } /** - * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection. + * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array. */ public inline fun DoubleArray.flatMap(transform: (Double) -> Iterable): List { return flatMapTo(ArrayList(), transform) } /** - * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection. + * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array. */ public inline fun FloatArray.flatMap(transform: (Float) -> Iterable): List { return flatMapTo(ArrayList(), transform) } /** - * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection. + * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array. */ public inline fun IntArray.flatMap(transform: (Int) -> Iterable): List { return flatMapTo(ArrayList(), transform) } /** - * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection. + * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array. */ public inline fun LongArray.flatMap(transform: (Long) -> Iterable): List { return flatMapTo(ArrayList(), transform) } /** - * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection. + * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array. */ public inline fun ShortArray.flatMap(transform: (Short) -> Iterable): List { return flatMapTo(ArrayList(), transform) } /** - * Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination]. + * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination]. */ public inline fun > Array.flatMapTo(destination: C, transform: (T) -> Iterable): C { for (element in this) { @@ -6062,7 +6071,7 @@ public inline fun > Array.flatMapTo(des } /** - * Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination]. + * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination]. */ public inline fun > BooleanArray.flatMapTo(destination: C, transform: (Boolean) -> Iterable): C { for (element in this) { @@ -6073,7 +6082,7 @@ public inline fun > BooleanArray.flatMapTo(destin } /** - * Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination]. + * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination]. */ public inline fun > ByteArray.flatMapTo(destination: C, transform: (Byte) -> Iterable): C { for (element in this) { @@ -6084,7 +6093,7 @@ public inline fun > ByteArray.flatMapTo(destinati } /** - * Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination]. + * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination]. */ public inline fun > CharArray.flatMapTo(destination: C, transform: (Char) -> Iterable): C { for (element in this) { @@ -6095,7 +6104,7 @@ public inline fun > CharArray.flatMapTo(destinati } /** - * Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination]. + * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination]. */ public inline fun > DoubleArray.flatMapTo(destination: C, transform: (Double) -> Iterable): C { for (element in this) { @@ -6106,7 +6115,7 @@ public inline fun > DoubleArray.flatMapTo(destina } /** - * Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination]. + * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination]. */ public inline fun > FloatArray.flatMapTo(destination: C, transform: (Float) -> Iterable): C { for (element in this) { @@ -6117,7 +6126,7 @@ public inline fun > FloatArray.flatMapTo(destinat } /** - * Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination]. + * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination]. */ public inline fun > IntArray.flatMapTo(destination: C, transform: (Int) -> Iterable): C { for (element in this) { @@ -6128,7 +6137,7 @@ public inline fun > IntArray.flatMapTo(destinatio } /** - * Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination]. + * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination]. */ public inline fun > LongArray.flatMapTo(destination: C, transform: (Long) -> Iterable): C { for (element in this) { @@ -6139,7 +6148,7 @@ public inline fun > LongArray.flatMapTo(destinati } /** - * Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination]. + * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination]. */ public inline fun > ShortArray.flatMapTo(destination: C, transform: (Short) -> Iterable): C { for (element in this) { @@ -6150,70 +6159,70 @@ public inline fun > ShortArray.flatMapTo(destinat } /** - * Returns a map of the elements in original collection grouped by the result of given [toKey] function. + * Returns a map of the elements in original array grouped by the result of given [toKey] function. */ public inline fun Array.groupBy(toKey: (T) -> K): Map> { return groupByTo(LinkedHashMap>(), toKey) } /** - * Returns a map of the elements in original collection grouped by the result of given [toKey] function. + * Returns a map of the elements in original array grouped by the result of given [toKey] function. */ public inline fun BooleanArray.groupBy(toKey: (Boolean) -> K): Map> { return groupByTo(LinkedHashMap>(), toKey) } /** - * Returns a map of the elements in original collection grouped by the result of given [toKey] function. + * Returns a map of the elements in original array grouped by the result of given [toKey] function. */ public inline fun ByteArray.groupBy(toKey: (Byte) -> K): Map> { return groupByTo(LinkedHashMap>(), toKey) } /** - * Returns a map of the elements in original collection grouped by the result of given [toKey] function. + * Returns a map of the elements in original array grouped by the result of given [toKey] function. */ public inline fun CharArray.groupBy(toKey: (Char) -> K): Map> { return groupByTo(LinkedHashMap>(), toKey) } /** - * Returns a map of the elements in original collection grouped by the result of given [toKey] function. + * Returns a map of the elements in original array grouped by the result of given [toKey] function. */ public inline fun DoubleArray.groupBy(toKey: (Double) -> K): Map> { return groupByTo(LinkedHashMap>(), toKey) } /** - * Returns a map of the elements in original collection grouped by the result of given [toKey] function. + * Returns a map of the elements in original array grouped by the result of given [toKey] function. */ public inline fun FloatArray.groupBy(toKey: (Float) -> K): Map> { return groupByTo(LinkedHashMap>(), toKey) } /** - * Returns a map of the elements in original collection grouped by the result of given [toKey] function. + * Returns a map of the elements in original array grouped by the result of given [toKey] function. */ public inline fun IntArray.groupBy(toKey: (Int) -> K): Map> { return groupByTo(LinkedHashMap>(), toKey) } /** - * Returns a map of the elements in original collection grouped by the result of given [toKey] function. + * Returns a map of the elements in original array grouped by the result of given [toKey] function. */ public inline fun LongArray.groupBy(toKey: (Long) -> K): Map> { return groupByTo(LinkedHashMap>(), toKey) } /** - * Returns a map of the elements in original collection grouped by the result of given [toKey] function. + * Returns a map of the elements in original array grouped by the result of given [toKey] function. */ public inline fun ShortArray.groupBy(toKey: (Short) -> K): Map> { return groupByTo(LinkedHashMap>(), toKey) } /** - * Appends elements from original collection grouped by the result of given [toKey] function to the given [map]. + * Appends elements from original array grouped by the result of given [toKey] function to the given [map]. */ public inline fun Array.groupByTo(map: MutableMap>, toKey: (T) -> K): Map> { for (element in this) { @@ -6225,7 +6234,7 @@ public inline fun Array.groupByTo(map: MutableMap BooleanArray.groupByTo(map: MutableMap>, toKey: (Boolean) -> K): Map> { for (element in this) { @@ -6237,7 +6246,7 @@ public inline fun BooleanArray.groupByTo(map: MutableMap ByteArray.groupByTo(map: MutableMap>, toKey: (Byte) -> K): Map> { for (element in this) { @@ -6249,7 +6258,7 @@ public inline fun ByteArray.groupByTo(map: MutableMap>, } /** - * Appends elements from original collection grouped by the result of given [toKey] function to the given [map]. + * Appends elements from original array grouped by the result of given [toKey] function to the given [map]. */ public inline fun CharArray.groupByTo(map: MutableMap>, toKey: (Char) -> K): Map> { for (element in this) { @@ -6261,7 +6270,7 @@ public inline fun CharArray.groupByTo(map: MutableMap>, } /** - * Appends elements from original collection grouped by the result of given [toKey] function to the given [map]. + * Appends elements from original array grouped by the result of given [toKey] function to the given [map]. */ public inline fun DoubleArray.groupByTo(map: MutableMap>, toKey: (Double) -> K): Map> { for (element in this) { @@ -6273,7 +6282,7 @@ public inline fun DoubleArray.groupByTo(map: MutableMap FloatArray.groupByTo(map: MutableMap>, toKey: (Float) -> K): Map> { for (element in this) { @@ -6285,7 +6294,7 @@ public inline fun FloatArray.groupByTo(map: MutableMap } /** - * Appends elements from original collection grouped by the result of given [toKey] function to the given [map]. + * Appends elements from original array grouped by the result of given [toKey] function to the given [map]. */ public inline fun IntArray.groupByTo(map: MutableMap>, toKey: (Int) -> K): Map> { for (element in this) { @@ -6297,7 +6306,7 @@ public inline fun IntArray.groupByTo(map: MutableMap>, t } /** - * Appends elements from original collection grouped by the result of given [toKey] function to the given [map]. + * Appends elements from original array grouped by the result of given [toKey] function to the given [map]. */ public inline fun LongArray.groupByTo(map: MutableMap>, toKey: (Long) -> K): Map> { for (element in this) { @@ -6309,7 +6318,7 @@ public inline fun LongArray.groupByTo(map: MutableMap>, } /** - * Appends elements from original collection grouped by the result of given [toKey] function to the given [map]. + * Appends elements from original array grouped by the result of given [toKey] function to the given [map]. */ public inline fun ShortArray.groupByTo(map: MutableMap>, toKey: (Short) -> K): Map> { for (element in this) { @@ -6321,133 +6330,133 @@ public inline fun ShortArray.groupByTo(map: MutableMap } /** - * Returns a list containing the results of applying the given [transform] function to each element of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element of the original array. */ public inline fun Array.map(transform: (T) -> R): List { return mapTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element of the original array. */ public inline fun BooleanArray.map(transform: (Boolean) -> R): List { return mapTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element of the original array. */ public inline fun ByteArray.map(transform: (Byte) -> R): List { return mapTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element of the original array. */ public inline fun CharArray.map(transform: (Char) -> R): List { return mapTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element of the original array. */ public inline fun DoubleArray.map(transform: (Double) -> R): List { return mapTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element of the original array. */ public inline fun FloatArray.map(transform: (Float) -> R): List { return mapTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element of the original array. */ public inline fun IntArray.map(transform: (Int) -> R): List { return mapTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element of the original array. */ public inline fun LongArray.map(transform: (Long) -> R): List { return mapTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element of the original array. */ public inline fun ShortArray.map(transform: (Short) -> R): List { return mapTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element and its index of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element and its index in the original array. */ public inline fun Array.mapIndexed(transform: (Int, T) -> R): List { return mapIndexedTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element and its index of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element and its index in the original array. */ public inline fun BooleanArray.mapIndexed(transform: (Int, Boolean) -> R): List { return mapIndexedTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element and its index of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element and its index in the original array. */ public inline fun ByteArray.mapIndexed(transform: (Int, Byte) -> R): List { return mapIndexedTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element and its index of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element and its index in the original array. */ public inline fun CharArray.mapIndexed(transform: (Int, Char) -> R): List { return mapIndexedTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element and its index of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element and its index in the original array. */ public inline fun DoubleArray.mapIndexed(transform: (Int, Double) -> R): List { return mapIndexedTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element and its index of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element and its index in the original array. */ public inline fun FloatArray.mapIndexed(transform: (Int, Float) -> R): List { return mapIndexedTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element and its index of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element and its index in the original array. */ public inline fun IntArray.mapIndexed(transform: (Int, Int) -> R): List { return mapIndexedTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element and its index of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element and its index in the original array. */ public inline fun LongArray.mapIndexed(transform: (Int, Long) -> R): List { return mapIndexedTo(ArrayList(size()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element and its index of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element and its index in the original array. */ public inline fun ShortArray.mapIndexed(transform: (Int, Short) -> R): List { return mapIndexedTo(ArrayList(size()), transform) } /** - * Appends transformed elements and their indices of the original collection using the given [transform] function + * Appends transformed elements and their indices in the original array using the given [transform] function * to the given [destination]. */ public inline fun > Array.mapIndexedTo(destination: C, transform: (Int, T) -> R): C { @@ -6458,7 +6467,7 @@ public inline fun > Array.mapIndexedTo( } /** - * Appends transformed elements and their indices of the original collection using the given [transform] function + * Appends transformed elements and their indices in the original array using the given [transform] function * to the given [destination]. */ public inline fun > BooleanArray.mapIndexedTo(destination: C, transform: (Int, Boolean) -> R): C { @@ -6469,7 +6478,7 @@ public inline fun > BooleanArray.mapIndexedTo(des } /** - * Appends transformed elements and their indices of the original collection using the given [transform] function + * Appends transformed elements and their indices in the original array using the given [transform] function * to the given [destination]. */ public inline fun > ByteArray.mapIndexedTo(destination: C, transform: (Int, Byte) -> R): C { @@ -6480,7 +6489,7 @@ public inline fun > ByteArray.mapIndexedTo(destin } /** - * Appends transformed elements and their indices of the original collection using the given [transform] function + * Appends transformed elements and their indices in the original array using the given [transform] function * to the given [destination]. */ public inline fun > CharArray.mapIndexedTo(destination: C, transform: (Int, Char) -> R): C { @@ -6491,7 +6500,7 @@ public inline fun > CharArray.mapIndexedTo(destin } /** - * Appends transformed elements and their indices of the original collection using the given [transform] function + * Appends transformed elements and their indices in the original array using the given [transform] function * to the given [destination]. */ public inline fun > DoubleArray.mapIndexedTo(destination: C, transform: (Int, Double) -> R): C { @@ -6502,7 +6511,7 @@ public inline fun > DoubleArray.mapIndexedTo(dest } /** - * Appends transformed elements and their indices of the original collection using the given [transform] function + * Appends transformed elements and their indices in the original array using the given [transform] function * to the given [destination]. */ public inline fun > FloatArray.mapIndexedTo(destination: C, transform: (Int, Float) -> R): C { @@ -6513,7 +6522,7 @@ public inline fun > FloatArray.mapIndexedTo(desti } /** - * Appends transformed elements and their indices of the original collection using the given [transform] function + * Appends transformed elements and their indices in the original array using the given [transform] function * to the given [destination]. */ public inline fun > IntArray.mapIndexedTo(destination: C, transform: (Int, Int) -> R): C { @@ -6524,7 +6533,7 @@ public inline fun > IntArray.mapIndexedTo(destina } /** - * Appends transformed elements and their indices of the original collection using the given [transform] function + * Appends transformed elements and their indices in the original array using the given [transform] function * to the given [destination]. */ public inline fun > LongArray.mapIndexedTo(destination: C, transform: (Int, Long) -> R): C { @@ -6535,7 +6544,7 @@ public inline fun > LongArray.mapIndexedTo(destin } /** - * Appends transformed elements and their indices of the original collection using the given [transform] function + * Appends transformed elements and their indices in the original array using the given [transform] function * to the given [destination]. */ public inline fun > ShortArray.mapIndexedTo(destination: C, transform: (Int, Short) -> R): C { @@ -6546,7 +6555,7 @@ public inline fun > ShortArray.mapIndexedTo(desti } /** - * Appends transformed elements of the original collection using the given [transform] function + * Appends transformed elements of the original array using the given [transform] function * to the given [destination]. */ public inline fun > Array.mapTo(destination: C, transform: (T) -> R): C { @@ -6556,7 +6565,7 @@ public inline fun > Array.mapTo(destina } /** - * Appends transformed elements of the original collection using the given [transform] function + * Appends transformed elements of the original array using the given [transform] function * to the given [destination]. */ public inline fun > BooleanArray.mapTo(destination: C, transform: (Boolean) -> R): C { @@ -6566,7 +6575,7 @@ public inline fun > BooleanArray.mapTo(destinatio } /** - * Appends transformed elements of the original collection using the given [transform] function + * Appends transformed elements of the original array using the given [transform] function * to the given [destination]. */ public inline fun > ByteArray.mapTo(destination: C, transform: (Byte) -> R): C { @@ -6576,7 +6585,7 @@ public inline fun > ByteArray.mapTo(destination: } /** - * Appends transformed elements of the original collection using the given [transform] function + * Appends transformed elements of the original array using the given [transform] function * to the given [destination]. */ public inline fun > CharArray.mapTo(destination: C, transform: (Char) -> R): C { @@ -6586,7 +6595,7 @@ public inline fun > CharArray.mapTo(destination: } /** - * Appends transformed elements of the original collection using the given [transform] function + * Appends transformed elements of the original array using the given [transform] function * to the given [destination]. */ public inline fun > DoubleArray.mapTo(destination: C, transform: (Double) -> R): C { @@ -6596,7 +6605,7 @@ public inline fun > DoubleArray.mapTo(destination } /** - * Appends transformed elements of the original collection using the given [transform] function + * Appends transformed elements of the original array using the given [transform] function * to the given [destination]. */ public inline fun > FloatArray.mapTo(destination: C, transform: (Float) -> R): C { @@ -6606,7 +6615,7 @@ public inline fun > FloatArray.mapTo(destination: } /** - * Appends transformed elements of the original collection using the given [transform] function + * Appends transformed elements of the original array using the given [transform] function * to the given [destination]. */ public inline fun > IntArray.mapTo(destination: C, transform: (Int) -> R): C { @@ -6616,7 +6625,7 @@ public inline fun > IntArray.mapTo(destination: C } /** - * Appends transformed elements of the original collection using the given [transform] function + * Appends transformed elements of the original array using the given [transform] function * to the given [destination]. */ public inline fun > LongArray.mapTo(destination: C, transform: (Long) -> R): C { @@ -6626,7 +6635,7 @@ public inline fun > LongArray.mapTo(destination: } /** - * Appends transformed elements of the original collection using the given [transform] function + * Appends transformed elements of the original array using the given [transform] function * to the given [destination]. */ public inline fun > ShortArray.mapTo(destination: C, transform: (Short) -> R): C { @@ -6636,143 +6645,143 @@ public inline fun > ShortArray.mapTo(destination: } /** - * Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection. + * Returns a lazy [Iterable] of [IndexedValue] for each element of the original array. */ public fun Array.withIndex(): Iterable> { return IndexingIterable { iterator() } } /** - * Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection. + * Returns a lazy [Iterable] of [IndexedValue] for each element of the original array. */ public fun BooleanArray.withIndex(): Iterable> { return IndexingIterable { iterator() } } /** - * Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection. + * Returns a lazy [Iterable] of [IndexedValue] for each element of the original array. */ public fun ByteArray.withIndex(): Iterable> { return IndexingIterable { iterator() } } /** - * Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection. + * Returns a lazy [Iterable] of [IndexedValue] for each element of the original array. */ public fun CharArray.withIndex(): Iterable> { return IndexingIterable { iterator() } } /** - * Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection. + * Returns a lazy [Iterable] of [IndexedValue] for each element of the original array. */ public fun DoubleArray.withIndex(): Iterable> { return IndexingIterable { iterator() } } /** - * Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection. + * Returns a lazy [Iterable] of [IndexedValue] for each element of the original array. */ public fun FloatArray.withIndex(): Iterable> { return IndexingIterable { iterator() } } /** - * Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection. + * Returns a lazy [Iterable] of [IndexedValue] for each element of the original array. */ public fun IntArray.withIndex(): Iterable> { return IndexingIterable { iterator() } } /** - * Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection. + * Returns a lazy [Iterable] of [IndexedValue] for each element of the original array. */ public fun LongArray.withIndex(): Iterable> { return IndexingIterable { iterator() } } /** - * Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection. + * Returns a lazy [Iterable] of [IndexedValue] for each element of the original array. */ public fun ShortArray.withIndex(): Iterable> { return IndexingIterable { iterator() } } /** - * Returns a list containing only distinct elements from the given collection. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array. + * The elements in the resulting list are in the same order as they were in the source array. */ public fun Array.distinct(): List { return this.toMutableSet().toList() } /** - * Returns a list containing only distinct elements from the given collection. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array. + * The elements in the resulting list are in the same order as they were in the source array. */ public fun BooleanArray.distinct(): List { return this.toMutableSet().toList() } /** - * Returns a list containing only distinct elements from the given collection. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array. + * The elements in the resulting list are in the same order as they were in the source array. */ public fun ByteArray.distinct(): List { return this.toMutableSet().toList() } /** - * Returns a list containing only distinct elements from the given collection. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array. + * The elements in the resulting list are in the same order as they were in the source array. */ public fun CharArray.distinct(): List { return this.toMutableSet().toList() } /** - * Returns a list containing only distinct elements from the given collection. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array. + * The elements in the resulting list are in the same order as they were in the source array. */ public fun DoubleArray.distinct(): List { return this.toMutableSet().toList() } /** - * Returns a list containing only distinct elements from the given collection. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array. + * The elements in the resulting list are in the same order as they were in the source array. */ public fun FloatArray.distinct(): List { return this.toMutableSet().toList() } /** - * Returns a list containing only distinct elements from the given collection. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array. + * The elements in the resulting list are in the same order as they were in the source array. */ public fun IntArray.distinct(): List { return this.toMutableSet().toList() } /** - * Returns a list containing only distinct elements from the given collection. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array. + * The elements in the resulting list are in the same order as they were in the source array. */ public fun LongArray.distinct(): List { return this.toMutableSet().toList() } /** - * Returns a list containing only distinct elements from the given collection. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array. + * The elements in the resulting list are in the same order as they were in the source array. */ public fun ShortArray.distinct(): List { return this.toMutableSet().toList() } /** - * Returns a list containing only distinct elements from the given collection according to the [keySelector]. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array according to the [keySelector]. + * The elements in the resulting list are in the same order as they were in the source array. */ public inline fun Array.distinctBy(keySelector: (T) -> K): List { val set = HashSet() @@ -6786,8 +6795,8 @@ public inline fun Array.distinctBy(keySelector: (T) -> K): List } /** - * Returns a list containing only distinct elements from the given collection according to the [keySelector]. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array according to the [keySelector]. + * The elements in the resulting list are in the same order as they were in the source array. */ public inline fun BooleanArray.distinctBy(keySelector: (Boolean) -> K): List { val set = HashSet() @@ -6801,8 +6810,8 @@ public inline fun BooleanArray.distinctBy(keySelector: (Boolean) -> K): List } /** - * Returns a list containing only distinct elements from the given collection according to the [keySelector]. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array according to the [keySelector]. + * The elements in the resulting list are in the same order as they were in the source array. */ public inline fun ByteArray.distinctBy(keySelector: (Byte) -> K): List { val set = HashSet() @@ -6816,8 +6825,8 @@ public inline fun ByteArray.distinctBy(keySelector: (Byte) -> K): List } /** - * Returns a list containing only distinct elements from the given collection according to the [keySelector]. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array according to the [keySelector]. + * The elements in the resulting list are in the same order as they were in the source array. */ public inline fun CharArray.distinctBy(keySelector: (Char) -> K): List { val set = HashSet() @@ -6831,8 +6840,8 @@ public inline fun CharArray.distinctBy(keySelector: (Char) -> K): List } /** - * Returns a list containing only distinct elements from the given collection according to the [keySelector]. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array according to the [keySelector]. + * The elements in the resulting list are in the same order as they were in the source array. */ public inline fun DoubleArray.distinctBy(keySelector: (Double) -> K): List { val set = HashSet() @@ -6846,8 +6855,8 @@ public inline fun DoubleArray.distinctBy(keySelector: (Double) -> K): List FloatArray.distinctBy(keySelector: (Float) -> K): List { val set = HashSet() @@ -6861,8 +6870,8 @@ public inline fun FloatArray.distinctBy(keySelector: (Float) -> K): List IntArray.distinctBy(keySelector: (Int) -> K): List { val set = HashSet() @@ -6876,8 +6885,8 @@ public inline fun IntArray.distinctBy(keySelector: (Int) -> K): List { } /** - * Returns a list containing only distinct elements from the given collection according to the [keySelector]. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array according to the [keySelector]. + * The elements in the resulting list are in the same order as they were in the source array. */ public inline fun LongArray.distinctBy(keySelector: (Long) -> K): List { val set = HashSet() @@ -6891,8 +6900,8 @@ public inline fun LongArray.distinctBy(keySelector: (Long) -> K): List } /** - * Returns a list containing only distinct elements from the given collection according to the [keySelector]. - * The elements in the resulting list are in the same order as they were in the source collection. + * Returns a list containing only distinct elements from the given array according to the [keySelector]. + * The elements in the resulting list are in the same order as they were in the source array. */ public inline fun ShortArray.distinctBy(keySelector: (Short) -> K): List { val set = HashSet() @@ -7068,7 +7077,7 @@ public fun ShortArray.subtract(other: Iterable): Set { } /** - * Returns a mutable set containing all distinct elements from the given collection. + * Returns a mutable set containing all distinct elements from the given array. */ public fun Array.toMutableSet(): MutableSet { val set = LinkedHashSet(mapCapacity(size())) @@ -7077,7 +7086,7 @@ public fun Array.toMutableSet(): MutableSet { } /** - * Returns a mutable set containing all distinct elements from the given collection. + * Returns a mutable set containing all distinct elements from the given array. */ public fun BooleanArray.toMutableSet(): MutableSet { val set = LinkedHashSet(mapCapacity(size())) @@ -7086,7 +7095,7 @@ public fun BooleanArray.toMutableSet(): MutableSet { } /** - * Returns a mutable set containing all distinct elements from the given collection. + * Returns a mutable set containing all distinct elements from the given array. */ public fun ByteArray.toMutableSet(): MutableSet { val set = LinkedHashSet(mapCapacity(size())) @@ -7095,7 +7104,7 @@ public fun ByteArray.toMutableSet(): MutableSet { } /** - * Returns a mutable set containing all distinct elements from the given collection. + * Returns a mutable set containing all distinct elements from the given array. */ public fun CharArray.toMutableSet(): MutableSet { val set = LinkedHashSet(mapCapacity(size())) @@ -7104,7 +7113,7 @@ public fun CharArray.toMutableSet(): MutableSet { } /** - * Returns a mutable set containing all distinct elements from the given collection. + * Returns a mutable set containing all distinct elements from the given array. */ public fun DoubleArray.toMutableSet(): MutableSet { val set = LinkedHashSet(mapCapacity(size())) @@ -7113,7 +7122,7 @@ public fun DoubleArray.toMutableSet(): MutableSet { } /** - * Returns a mutable set containing all distinct elements from the given collection. + * Returns a mutable set containing all distinct elements from the given array. */ public fun FloatArray.toMutableSet(): MutableSet { val set = LinkedHashSet(mapCapacity(size())) @@ -7122,7 +7131,7 @@ public fun FloatArray.toMutableSet(): MutableSet { } /** - * Returns a mutable set containing all distinct elements from the given collection. + * Returns a mutable set containing all distinct elements from the given array. */ public fun IntArray.toMutableSet(): MutableSet { val set = LinkedHashSet(mapCapacity(size())) @@ -7131,7 +7140,7 @@ public fun IntArray.toMutableSet(): MutableSet { } /** - * Returns a mutable set containing all distinct elements from the given collection. + * Returns a mutable set containing all distinct elements from the given array. */ public fun LongArray.toMutableSet(): MutableSet { val set = LinkedHashSet(mapCapacity(size())) @@ -7140,7 +7149,7 @@ public fun LongArray.toMutableSet(): MutableSet { } /** - * Returns a mutable set containing all distinct elements from the given collection. + * Returns a mutable set containing all distinct elements from the given array. */ public fun ShortArray.toMutableSet(): MutableSet { val set = LinkedHashSet(mapCapacity(size())) @@ -7302,7 +7311,7 @@ public inline fun ShortArray.all(predicate: (Short) -> Boolean): Boolean { } /** - * Returns `true` if collection has at least one element. + * Returns `true` if array has at least one element. */ public fun Array.any(): Boolean { for (element in this) return true @@ -7310,7 +7319,7 @@ public fun Array.any(): Boolean { } /** - * Returns `true` if collection has at least one element. + * Returns `true` if array has at least one element. */ public fun BooleanArray.any(): Boolean { for (element in this) return true @@ -7318,7 +7327,7 @@ public fun BooleanArray.any(): Boolean { } /** - * Returns `true` if collection has at least one element. + * Returns `true` if array has at least one element. */ public fun ByteArray.any(): Boolean { for (element in this) return true @@ -7326,7 +7335,7 @@ public fun ByteArray.any(): Boolean { } /** - * Returns `true` if collection has at least one element. + * Returns `true` if array has at least one element. */ public fun CharArray.any(): Boolean { for (element in this) return true @@ -7334,7 +7343,7 @@ public fun CharArray.any(): Boolean { } /** - * Returns `true` if collection has at least one element. + * Returns `true` if array has at least one element. */ public fun DoubleArray.any(): Boolean { for (element in this) return true @@ -7342,7 +7351,7 @@ public fun DoubleArray.any(): Boolean { } /** - * Returns `true` if collection has at least one element. + * Returns `true` if array has at least one element. */ public fun FloatArray.any(): Boolean { for (element in this) return true @@ -7350,7 +7359,7 @@ public fun FloatArray.any(): Boolean { } /** - * Returns `true` if collection has at least one element. + * Returns `true` if array has at least one element. */ public fun IntArray.any(): Boolean { for (element in this) return true @@ -7358,7 +7367,7 @@ public fun IntArray.any(): Boolean { } /** - * Returns `true` if collection has at least one element. + * Returns `true` if array has at least one element. */ public fun LongArray.any(): Boolean { for (element in this) return true @@ -7366,7 +7375,7 @@ public fun LongArray.any(): Boolean { } /** - * Returns `true` if collection has at least one element. + * Returns `true` if array has at least one element. */ public fun ShortArray.any(): Boolean { for (element in this) return true @@ -7446,63 +7455,63 @@ public inline fun ShortArray.any(predicate: (Short) -> Boolean): Boolean { } /** - * Returns the number of elements in this collection. + * Returns the number of elements in this array. */ public fun Array.count(): Int { return size() } /** - * Returns the number of elements in this collection. + * Returns the number of elements in this array. */ public fun BooleanArray.count(): Int { return size() } /** - * Returns the number of elements in this collection. + * Returns the number of elements in this array. */ public fun ByteArray.count(): Int { return size() } /** - * Returns the number of elements in this collection. + * Returns the number of elements in this array. */ public fun CharArray.count(): Int { return size() } /** - * Returns the number of elements in this collection. + * Returns the number of elements in this array. */ public fun DoubleArray.count(): Int { return size() } /** - * Returns the number of elements in this collection. + * Returns the number of elements in this array. */ public fun FloatArray.count(): Int { return size() } /** - * Returns the number of elements in this collection. + * Returns the number of elements in this array. */ public fun IntArray.count(): Int { return size() } /** - * Returns the number of elements in this collection. + * Returns the number of elements in this array. */ public fun LongArray.count(): Int { return size() } /** - * Returns the number of elements in this collection. + * Returns the number of elements in this array. */ public fun ShortArray.count(): Int { return size() @@ -8446,7 +8455,7 @@ public inline fun > ShortArray.minBy(f: (Short) -> R): Short? } /** - * Returns `true` if collection has no elements. + * Returns `true` if the array has no elements. */ public fun Array.none(): Boolean { for (element in this) return false @@ -8454,7 +8463,7 @@ public fun Array.none(): Boolean { } /** - * Returns `true` if collection has no elements. + * Returns `true` if the array has no elements. */ public fun BooleanArray.none(): Boolean { for (element in this) return false @@ -8462,7 +8471,7 @@ public fun BooleanArray.none(): Boolean { } /** - * Returns `true` if collection has no elements. + * Returns `true` if the array has no elements. */ public fun ByteArray.none(): Boolean { for (element in this) return false @@ -8470,7 +8479,7 @@ public fun ByteArray.none(): Boolean { } /** - * Returns `true` if collection has no elements. + * Returns `true` if the array has no elements. */ public fun CharArray.none(): Boolean { for (element in this) return false @@ -8478,7 +8487,7 @@ public fun CharArray.none(): Boolean { } /** - * Returns `true` if collection has no elements. + * Returns `true` if the array has no elements. */ public fun DoubleArray.none(): Boolean { for (element in this) return false @@ -8486,7 +8495,7 @@ public fun DoubleArray.none(): Boolean { } /** - * Returns `true` if collection has no elements. + * Returns `true` if the array has no elements. */ public fun FloatArray.none(): Boolean { for (element in this) return false @@ -8494,7 +8503,7 @@ public fun FloatArray.none(): Boolean { } /** - * Returns `true` if collection has no elements. + * Returns `true` if the array has no elements. */ public fun IntArray.none(): Boolean { for (element in this) return false @@ -8502,7 +8511,7 @@ public fun IntArray.none(): Boolean { } /** - * Returns `true` if collection has no elements. + * Returns `true` if the array has no elements. */ public fun LongArray.none(): Boolean { for (element in this) return false @@ -8510,7 +8519,7 @@ public fun LongArray.none(): Boolean { } /** - * Returns `true` if collection has no elements. + * Returns `true` if the array has no elements. */ public fun ShortArray.none(): Boolean { for (element in this) return false @@ -8824,7 +8833,7 @@ public inline fun ShortArray.reduceRight(operation: (Short, Short) -> Short): Sh } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun Array.sumBy(transform: (T) -> Int): Int { var sum: Int = 0 @@ -8835,7 +8844,7 @@ public inline fun Array.sumBy(transform: (T) -> Int): Int { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun BooleanArray.sumBy(transform: (Boolean) -> Int): Int { var sum: Int = 0 @@ -8846,7 +8855,7 @@ public inline fun BooleanArray.sumBy(transform: (Boolean) -> Int): Int { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun ByteArray.sumBy(transform: (Byte) -> Int): Int { var sum: Int = 0 @@ -8857,7 +8866,7 @@ public inline fun ByteArray.sumBy(transform: (Byte) -> Int): Int { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun CharArray.sumBy(transform: (Char) -> Int): Int { var sum: Int = 0 @@ -8868,7 +8877,7 @@ public inline fun CharArray.sumBy(transform: (Char) -> Int): Int { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun DoubleArray.sumBy(transform: (Double) -> Int): Int { var sum: Int = 0 @@ -8879,7 +8888,7 @@ public inline fun DoubleArray.sumBy(transform: (Double) -> Int): Int { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun FloatArray.sumBy(transform: (Float) -> Int): Int { var sum: Int = 0 @@ -8890,7 +8899,7 @@ public inline fun FloatArray.sumBy(transform: (Float) -> Int): Int { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun IntArray.sumBy(transform: (Int) -> Int): Int { var sum: Int = 0 @@ -8901,7 +8910,7 @@ public inline fun IntArray.sumBy(transform: (Int) -> Int): Int { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun LongArray.sumBy(transform: (Long) -> Int): Int { var sum: Int = 0 @@ -8912,7 +8921,7 @@ public inline fun LongArray.sumBy(transform: (Long) -> Int): Int { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun ShortArray.sumBy(transform: (Short) -> Int): Int { var sum: Int = 0 @@ -8923,7 +8932,7 @@ public inline fun ShortArray.sumBy(transform: (Short) -> Int): Int { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun Array.sumByDouble(transform: (T) -> Double): Double { var sum: Double = 0.0 @@ -8934,7 +8943,7 @@ public inline fun Array.sumByDouble(transform: (T) -> Double): Double } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun BooleanArray.sumByDouble(transform: (Boolean) -> Double): Double { var sum: Double = 0.0 @@ -8945,7 +8954,7 @@ public inline fun BooleanArray.sumByDouble(transform: (Boolean) -> Double): Doub } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun ByteArray.sumByDouble(transform: (Byte) -> Double): Double { var sum: Double = 0.0 @@ -8956,7 +8965,7 @@ public inline fun ByteArray.sumByDouble(transform: (Byte) -> Double): Double { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun CharArray.sumByDouble(transform: (Char) -> Double): Double { var sum: Double = 0.0 @@ -8967,7 +8976,7 @@ public inline fun CharArray.sumByDouble(transform: (Char) -> Double): Double { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun DoubleArray.sumByDouble(transform: (Double) -> Double): Double { var sum: Double = 0.0 @@ -8978,7 +8987,7 @@ public inline fun DoubleArray.sumByDouble(transform: (Double) -> Double): Double } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun FloatArray.sumByDouble(transform: (Float) -> Double): Double { var sum: Double = 0.0 @@ -8989,7 +8998,7 @@ public inline fun FloatArray.sumByDouble(transform: (Float) -> Double): Double { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun IntArray.sumByDouble(transform: (Int) -> Double): Double { var sum: Double = 0.0 @@ -9000,7 +9009,7 @@ public inline fun IntArray.sumByDouble(transform: (Int) -> Double): Double { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun LongArray.sumByDouble(transform: (Long) -> Double): Double { var sum: Double = 0.0 @@ -9011,7 +9020,7 @@ public inline fun LongArray.sumByDouble(transform: (Long) -> Double): Double { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the array. */ public inline fun ShortArray.sumByDouble(transform: (Short) -> Double): Double { var sum: Double = 0.0 @@ -9034,9 +9043,9 @@ public fun Array.requireNoNulls(): Array { } /** - * Splits the original collection into pair of collections, - * where *first* collection contains elements for which [predicate] yielded `true`, - * while *second* collection contains elements for which [predicate] yielded `false`. + * Splits the original array into pair of lists, + * where *first* list contains elements for which [predicate] yielded `true`, + * while *second* list contains elements for which [predicate] yielded `false`. */ public inline fun Array.partition(predicate: (T) -> Boolean): Pair, List> { val first = ArrayList() @@ -9052,9 +9061,9 @@ public inline fun Array.partition(predicate: (T) -> Boolean): Pair
  • Boolean): Pair, List> { val first = ArrayList() @@ -9070,9 +9079,9 @@ public inline fun BooleanArray.partition(predicate: (Boolean) -> Boolean): Pair< } /** - * Splits the original collection into pair of collections, - * where *first* collection contains elements for which [predicate] yielded `true`, - * while *second* collection contains elements for which [predicate] yielded `false`. + * Splits the original array into pair of lists, + * where *first* list contains elements for which [predicate] yielded `true`, + * while *second* list contains elements for which [predicate] yielded `false`. */ public inline fun ByteArray.partition(predicate: (Byte) -> Boolean): Pair, List> { val first = ArrayList() @@ -9088,9 +9097,9 @@ public inline fun ByteArray.partition(predicate: (Byte) -> Boolean): Pair Boolean): Pair, List> { val first = ArrayList() @@ -9106,9 +9115,9 @@ public inline fun CharArray.partition(predicate: (Char) -> Boolean): Pair Boolean): Pair, List> { val first = ArrayList() @@ -9124,9 +9133,9 @@ public inline fun DoubleArray.partition(predicate: (Double) -> Boolean): Pair
  • Boolean): Pair, List> { val first = ArrayList() @@ -9142,9 +9151,9 @@ public inline fun FloatArray.partition(predicate: (Float) -> Boolean): Pair Boolean): Pair, List> { val first = ArrayList() @@ -9160,9 +9169,9 @@ public inline fun IntArray.partition(predicate: (Int) -> Boolean): Pair Boolean): Pair, List> { val first = ArrayList() @@ -9178,9 +9187,9 @@ public inline fun LongArray.partition(predicate: (Long) -> Boolean): Pair Boolean): Pair, List> { val first = ArrayList() @@ -11100,7 +11109,7 @@ public fun ShortArray.toTypedArray(): Array { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the array. */ @kotlin.jvm.JvmName("averageOfByte") public fun Array.average(): Double { @@ -11115,7 +11124,7 @@ public fun Array.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the array. */ @kotlin.jvm.JvmName("averageOfDouble") public fun Array.average(): Double { @@ -11130,7 +11139,7 @@ public fun Array.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the array. */ @kotlin.jvm.JvmName("averageOfFloat") public fun Array.average(): Double { @@ -11145,7 +11154,7 @@ public fun Array.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the array. */ @kotlin.jvm.JvmName("averageOfInt") public fun Array.average(): Double { @@ -11160,7 +11169,7 @@ public fun Array.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the array. */ @kotlin.jvm.JvmName("averageOfLong") public fun Array.average(): Double { @@ -11175,7 +11184,7 @@ public fun Array.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the array. */ @kotlin.jvm.JvmName("averageOfShort") public fun Array.average(): Double { @@ -11190,7 +11199,7 @@ public fun Array.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the array. */ public fun ByteArray.average(): Double { val iterator = iterator() @@ -11204,7 +11213,7 @@ public fun ByteArray.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the array. */ public fun DoubleArray.average(): Double { val iterator = iterator() @@ -11218,7 +11227,7 @@ public fun DoubleArray.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the array. */ public fun FloatArray.average(): Double { val iterator = iterator() @@ -11232,7 +11241,7 @@ public fun FloatArray.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the array. */ public fun IntArray.average(): Double { val iterator = iterator() @@ -11246,7 +11255,7 @@ public fun IntArray.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the array. */ public fun LongArray.average(): Double { val iterator = iterator() @@ -11260,7 +11269,7 @@ public fun LongArray.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the array. */ public fun ShortArray.average(): Double { val iterator = iterator() @@ -11274,7 +11283,7 @@ public fun ShortArray.average(): Double { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the array. */ @kotlin.jvm.JvmName("sumOfByte") public fun Array.sum(): Int { @@ -11287,7 +11296,7 @@ public fun Array.sum(): Int { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the array. */ @kotlin.jvm.JvmName("sumOfDouble") public fun Array.sum(): Double { @@ -11300,7 +11309,7 @@ public fun Array.sum(): Double { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the array. */ @kotlin.jvm.JvmName("sumOfFloat") public fun Array.sum(): Float { @@ -11313,7 +11322,7 @@ public fun Array.sum(): Float { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the array. */ @kotlin.jvm.JvmName("sumOfInt") public fun Array.sum(): Int { @@ -11326,7 +11335,7 @@ public fun Array.sum(): Int { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the array. */ @kotlin.jvm.JvmName("sumOfLong") public fun Array.sum(): Long { @@ -11339,7 +11348,7 @@ public fun Array.sum(): Long { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the array. */ @kotlin.jvm.JvmName("sumOfShort") public fun Array.sum(): Int { @@ -11352,7 +11361,7 @@ public fun Array.sum(): Int { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the array. */ public fun ByteArray.sum(): Int { val iterator = iterator() @@ -11364,7 +11373,7 @@ public fun ByteArray.sum(): Int { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the array. */ public fun DoubleArray.sum(): Double { val iterator = iterator() @@ -11376,7 +11385,7 @@ public fun DoubleArray.sum(): Double { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the array. */ public fun FloatArray.sum(): Float { val iterator = iterator() @@ -11388,7 +11397,7 @@ public fun FloatArray.sum(): Float { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the array. */ public fun IntArray.sum(): Int { val iterator = iterator() @@ -11400,7 +11409,7 @@ public fun IntArray.sum(): Int { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the array. */ public fun LongArray.sum(): Long { val iterator = iterator() @@ -11412,7 +11421,7 @@ public fun LongArray.sum(): Long { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the array. */ public fun ShortArray.sum(): Int { val iterator = iterator() diff --git a/libraries/stdlib/src/generated/_Collections.kt b/libraries/stdlib/src/generated/_Collections.kt index fbd060ec309..72b653dd6f5 100644 --- a/libraries/stdlib/src/generated/_Collections.kt +++ b/libraries/stdlib/src/generated/_Collections.kt @@ -147,7 +147,7 @@ public fun List.elementAtOrNull(index: Int): T? { } /** - * Returns the first element matching the given [predicate], or `null` if element was not found. + * Returns the first element matching the given [predicate], or `null` if no such element was found. */ public inline fun Iterable.find(predicate: (T) -> Boolean): T? { return firstOrNull(predicate) @@ -980,7 +980,7 @@ public inline fun Iterable.toMap(selector: (T) -> K): Map { } /** - * Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection. + * Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to elements of the given collection. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun Iterable.toMap(selector: (T) -> K, transform: (T) -> V): Map { @@ -993,7 +993,8 @@ public inline fun Iterable.toMap(selector: (T) -> K, transform: (T) } /** - * Returns Map containing the values from the given collection indexed by [selector]. + * Returns Map containing the elements from the given collection indexed by the key + * returned from [selector] function applied to each element. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun Iterable.toMapBy(selector: (T) -> K): Map { @@ -1064,14 +1065,14 @@ public inline fun Iterable.map(transform: (T) -> R): List { } /** - * Returns a list containing the results of applying the given [transform] function to each element and its index of the original collection. + * Returns a list containing the results of applying the given [transform] function to each element and its index in the original collection. */ public inline fun Iterable.mapIndexed(transform: (Int, T) -> R): List { return mapIndexedTo(ArrayList(collectionSizeOrDefault(10)), transform) } /** - * Appends transformed elements and their indices of the original collection using the given [transform] function + * Appends transformed elements and their indices in the original collection using the given [transform] function * to the given [destination]. */ public inline fun > Iterable.mapIndexedTo(destination: C, transform: (Int, T) -> R): C { @@ -1310,7 +1311,7 @@ public inline fun , T : Any> Iterable.minBy(f: (T) -> R): T } /** - * Returns `true` if collection has no elements. + * Returns `true` if the collection has no elements. */ public fun Iterable.none(): Boolean { for (element in this) return false @@ -1352,7 +1353,7 @@ public inline fun List.reduceRight(operation: (T, S) -> S): S { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the collection. */ public inline fun Iterable.sumBy(transform: (T) -> Int): Int { var sum: Int = 0 @@ -1363,7 +1364,7 @@ public inline fun Iterable.sumBy(transform: (T) -> Int): Int { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the collection. */ public inline fun Iterable.sumByDouble(transform: (T) -> Double): Double { var sum: Double = 0.0 @@ -1436,9 +1437,9 @@ public operator fun Iterable.minus(sequence: Sequence): List { } /** - * Splits the original collection into pair of collections, - * where *first* collection contains elements for which [predicate] yielded `true`, - * while *second* collection contains elements for which [predicate] yielded `false`. + * Splits the original collection into pair of lists, + * where *first* list contains elements for which [predicate] yielded `true`, + * while *second* list contains elements for which [predicate] yielded `false`. */ public inline fun Iterable.partition(predicate: (T) -> Boolean): Pair, List> { val first = ArrayList() diff --git a/libraries/stdlib/src/generated/_Maps.kt b/libraries/stdlib/src/generated/_Maps.kt index 609543560c6..9b2fec44b91 100644 --- a/libraries/stdlib/src/generated/_Maps.kt +++ b/libraries/stdlib/src/generated/_Maps.kt @@ -23,14 +23,14 @@ public fun Map.toList(): List> { } /** - * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection. + * Returns a single list of all elements yielded from results of [transform] function being invoked on each entry of original map. */ public inline fun Map.flatMap(transform: (Map.Entry) -> Iterable): List { return flatMapTo(ArrayList(), transform) } /** - * Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination]. + * Appends all elements yielded from results of [transform] function being invoked on each entry of original map, to the given [destination]. */ public inline fun > Map.flatMapTo(destination: C, transform: (Map.Entry) -> Iterable): C { for (element in this) { @@ -41,14 +41,14 @@ public inline fun > Map.flatMapTo(des } /** - * Returns a list containing the results of applying the given [transform] function to each element of the original collection. + * Returns a list containing the results of applying the given [transform] function to each entry of the original map. */ public inline fun Map.map(transform: (Map.Entry) -> R): List { return mapTo(ArrayList(size()), transform) } /** - * Appends transformed elements and their indices of the original collection using the given [transform] function + * Appends transformed entrys and their indices in the original map using the given [transform] function * to the given [destination]. */ public inline fun > Map.mapIndexedTo(destination: C, transform: (Int, Map.Entry) -> R): C { @@ -59,7 +59,7 @@ public inline fun > Map.mapIndexedTo( } /** - * Appends transformed elements of the original collection using the given [transform] function + * Appends transformed entrys of the original map using the given [transform] function * to the given [destination]. */ public inline fun > Map.mapTo(destination: C, transform: (Map.Entry) -> R): C { @@ -69,7 +69,7 @@ public inline fun > Map.mapTo(destina } /** - * Returns `true` if all elements match the given [predicate]. + * Returns `true` if all entrys match the given [predicate]. */ public inline fun Map.all(predicate: (Map.Entry) -> Boolean): Boolean { for (element in this) if (!predicate(element)) return false @@ -77,7 +77,7 @@ public inline fun Map.all(predicate: (Map.Entry) -> Boolean): } /** - * Returns `true` if collection has at least one element. + * Returns `true` if map has at least one entry. */ public fun Map.any(): Boolean { for (element in this) return true @@ -85,7 +85,7 @@ public fun Map.any(): Boolean { } /** - * Returns `true` if at least one element matches the given [predicate]. + * Returns `true` if at least one entry matches the given [predicate]. */ public inline fun Map.any(predicate: (Map.Entry) -> Boolean): Boolean { for (element in this) if (predicate(element)) return true @@ -93,14 +93,14 @@ public inline fun Map.any(predicate: (Map.Entry) -> Boolean): } /** - * Returns the number of elements in this collection. + * Returns the number of entrys in this map. */ public fun Map.count(): Int { return size() } /** - * Returns the number of elements matching the given [predicate]. + * Returns the number of entrys matching the given [predicate]. */ public inline fun Map.count(predicate: (Map.Entry) -> Boolean): Int { var count = 0 @@ -109,14 +109,14 @@ public inline fun Map.count(predicate: (Map.Entry) -> Boolean } /** - * Performs the given [operation] on each element. + * Performs the given [operation] on each entry. */ public inline fun Map.forEach(operation: (Map.Entry) -> Unit): Unit { for (element in this) operation(element) } /** - * Returns the first element yielding the largest value of the given function or `null` if there are no elements. + * Returns the first map entry yielding the largest value of the given function or `null` if there are no entries. */ public inline fun > Map.maxBy(f: (Map.Entry) -> R): Map.Entry? { val iterator = iterator() @@ -135,7 +135,7 @@ public inline fun > Map.maxBy(f: (Map.Entry) } /** - * Returns the first element yielding the smallest value of the given function or `null` if there are no elements. + * Returns the first map entry yielding the smallest value of the given function or `null` if there are no entries. */ public inline fun > Map.minBy(f: (Map.Entry) -> R): Map.Entry? { val iterator = iterator() @@ -154,7 +154,7 @@ public inline fun > Map.minBy(f: (Map.Entry) } /** - * Returns `true` if collection has no elements. + * Returns `true` if the map has no entrys. */ public fun Map.none(): Boolean { for (element in this) return false @@ -162,7 +162,7 @@ public fun Map.none(): Boolean { } /** - * Returns `true` if no elements match the given [predicate]. + * Returns `true` if no entrys match the given [predicate]. */ public inline fun Map.none(predicate: (Map.Entry) -> Boolean): Boolean { for (element in this) if (predicate(element)) return false diff --git a/libraries/stdlib/src/generated/_Sequences.kt b/libraries/stdlib/src/generated/_Sequences.kt index f3d1b3008eb..d5918fcd11a 100644 --- a/libraries/stdlib/src/generated/_Sequences.kt +++ b/libraries/stdlib/src/generated/_Sequences.kt @@ -13,7 +13,7 @@ import java.util.* import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js /** - * Returns `true` if [element] is found in the collection. + * Returns `true` if [element] is found in the sequence. */ public operator fun Sequence.contains(element: @kotlin.internal.NoInfer T): Boolean { return indexOf(element) >= 0 @@ -30,7 +30,7 @@ public operator fun Sequence.contains(element: T): Boolean { } /** - * Returns `true` if [element] is found in the collection. + * Returns `true` if [element] is found in the sequence. * Allows to overcome type-safety restriction of `contains` that requires to pass an element of type `T`. */ @Suppress("NOTHING_TO_INLINE") @@ -39,14 +39,14 @@ public inline fun Sequence<*>.containsRaw(element: Any?): Boolean { } /** - * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this sequence. */ public fun Sequence.elementAt(index: Int): T { return elementAtOrElse(index) { throw IndexOutOfBoundsException("Sequence doesn't contain element at index $index.") } } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this sequence. */ public fun Sequence.elementAtOrElse(index: Int, defaultValue: (Int) -> T): T { if (index < 0) @@ -62,7 +62,7 @@ public fun Sequence.elementAtOrElse(index: Int, defaultValue: (Int) -> T) } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this sequence. */ public fun Sequence.elementAtOrNull(index: Int): T? { if (index < 0) @@ -78,7 +78,7 @@ public fun Sequence.elementAtOrNull(index: Int): T? { } /** - * Returns the first element matching the given [predicate], or `null` if element was not found. + * Returns the first element matching the given [predicate], or `null` if no such element was found. */ public inline fun Sequence.find(predicate: (T) -> Boolean): T? { return firstOrNull(predicate) @@ -93,7 +93,7 @@ public inline fun Sequence.findLast(predicate: (T) -> Boolean): T? { /** * Returns first element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the sequence is empty. */ public fun Sequence.first(): T { val iterator = iterator() @@ -112,7 +112,7 @@ public inline fun Sequence.first(predicate: (T) -> Boolean): T { } /** - * Returns the first element, or `null` if the collection is empty. + * Returns the first element, or `null` if the sequence is empty. */ public fun Sequence.firstOrNull(): T? { val iterator = iterator() @@ -130,7 +130,7 @@ public inline fun Sequence.firstOrNull(predicate: (T) -> Boolean): T? { } /** - * Returns first index of [element], or -1 if the collection does not contain element. + * Returns first index of [element], or -1 if the sequence does not contain element. */ public fun Sequence.indexOf(element: @kotlin.internal.NoInfer T): Int { var index = 0 @@ -154,7 +154,7 @@ public fun Sequence.indexOf(element: T): Int { } /** - * Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the first element matching the given [predicate], or -1 if the sequence does not contain such element. */ public inline fun Sequence.indexOfFirst(predicate: (T) -> Boolean): Int { var index = 0 @@ -167,7 +167,7 @@ public inline fun Sequence.indexOfFirst(predicate: (T) -> Boolean): Int { } /** - * Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the last element matching the given [predicate], or -1 if the sequence does not contain such element. */ public inline fun Sequence.indexOfLast(predicate: (T) -> Boolean): Int { var lastIndex = -1 @@ -181,7 +181,7 @@ public inline fun Sequence.indexOfLast(predicate: (T) -> Boolean): Int { } /** - * Returns first index of [element], or -1 if the collection does not contain element. + * Returns first index of [element], or -1 if the sequence does not contain element. * Allows to overcome type-safety restriction of `indexOf` that requires to pass an element of type `T`. */ @Suppress("NOTHING_TO_INLINE") @@ -191,7 +191,7 @@ public inline fun Sequence<*>.indexOfRaw(element: Any?): Int { /** * Returns the last element. - * @throws [NoSuchElementException] if the collection is empty. + * @throws [NoSuchElementException] if the sequence is empty. */ public fun Sequence.last(): T { val iterator = iterator() @@ -221,7 +221,7 @@ public inline fun Sequence.last(predicate: (T) -> Boolean): T { } /** - * Returns last index of [element], or -1 if the collection does not contain element. + * Returns last index of [element], or -1 if the sequence does not contain element. */ public fun Sequence.lastIndexOf(element: @kotlin.internal.NoInfer T): Int { var lastIndex = -1 @@ -246,7 +246,7 @@ public fun Sequence.lastIndexOf(element: T): Int { } /** - * Returns last index of [element], or -1 if the collection does not contain element. + * Returns last index of [element], or -1 if the sequence does not contain element. * Allows to overcome type-safety restriction of `lastIndexOf` that requires to pass an element of type `T`. */ @Suppress("NOTHING_TO_INLINE") @@ -255,7 +255,7 @@ public inline fun Sequence<*>.lastIndexOfRaw(element: Any?): Int { } /** - * Returns the last element, or `null` if the collection is empty. + * Returns the last element, or `null` if the sequence is empty. */ public fun Sequence.lastOrNull(): T? { val iterator = iterator() @@ -281,7 +281,7 @@ public inline fun Sequence.lastOrNull(predicate: (T) -> Boolean): T? { } /** - * Returns the single element, or throws an exception if the collection is empty or has more than one element. + * Returns the single element, or throws an exception if the sequence is empty or has more than one element. */ public fun Sequence.single(): T { val iterator = iterator() @@ -311,7 +311,7 @@ public inline fun Sequence.single(predicate: (T) -> Boolean): T { } /** - * Returns single element, or `null` if the collection is empty or has more than one element. + * Returns single element, or `null` if the sequence is empty or has more than one element. */ public fun Sequence.singleOrNull(): T? { val iterator = iterator() @@ -507,7 +507,7 @@ public inline fun Sequence.toMap(selector: (T) -> K): Map { } /** - * Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection. + * Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to elements of the given sequence. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun Sequence.toMap(selector: (T) -> K, transform: (T) -> V): Map { @@ -519,7 +519,8 @@ public inline fun Sequence.toMap(selector: (T) -> K, transform: (T) } /** - * Returns Map containing the values from the given collection indexed by [selector]. + * Returns Map containing the elements from the given sequence indexed by the key + * returned from [selector] function applied to each element. * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun Sequence.toMapBy(selector: (T) -> K): Map { @@ -563,14 +564,14 @@ public inline fun > Sequence.flatMapTo(dest } /** - * Returns a map of the elements in original collection grouped by the result of given [toKey] function. + * Returns a map of the elements in original sequence grouped by the result of given [toKey] function. */ public inline fun Sequence.groupBy(toKey: (T) -> K): Map> { return groupByTo(LinkedHashMap>(), toKey) } /** - * Appends elements from original collection grouped by the result of given [toKey] function to the given [map]. + * Appends elements from original sequence grouped by the result of given [toKey] function to the given [map]. */ public inline fun Sequence.groupByTo(map: MutableMap>, toKey: (T) -> K): Map> { for (element in this) { @@ -589,14 +590,14 @@ public fun Sequence.map(transform: (T) -> R): Sequence { } /** - * Returns a sequence containing the results of applying the given [transform] function to each element and its index of the original sequence. + * Returns a sequence containing the results of applying the given [transform] function to each element and its index in the original sequence. */ public fun Sequence.mapIndexed(transform: (Int, T) -> R): Sequence { return TransformingIndexedSequence(this, transform) } /** - * Appends transformed elements and their indices of the original collection using the given [transform] function + * Appends transformed elements and their indices in the original sequence using the given [transform] function * to the given [destination]. */ public inline fun > Sequence.mapIndexedTo(destination: C, transform: (Int, T) -> R): C { @@ -607,7 +608,7 @@ public inline fun > Sequence.mapIndexedTo(d } /** - * Appends transformed elements of the original collection using the given [transform] function + * Appends transformed elements of the original sequence using the given [transform] function * to the given [destination]. */ public inline fun > Sequence.mapTo(destination: C, transform: (T) -> R): C { @@ -657,7 +658,7 @@ public inline fun Sequence.all(predicate: (T) -> Boolean): Boolean { } /** - * Returns `true` if collection has at least one element. + * Returns `true` if sequence has at least one element. */ public fun Sequence.any(): Boolean { for (element in this) return true @@ -673,7 +674,7 @@ public inline fun Sequence.any(predicate: (T) -> Boolean): Boolean { } /** - * Returns the number of elements in this collection. + * Returns the number of elements in this sequence. */ public fun Sequence.count(): Int { var count = 0 @@ -781,7 +782,7 @@ public inline fun , T : Any> Sequence.minBy(f: (T) -> R): T } /** - * Returns `true` if collection has no elements. + * Returns `true` if the sequence has no elements. */ public fun Sequence.none(): Boolean { for (element in this) return false @@ -810,7 +811,7 @@ public inline fun Sequence.reduce(operation: (S, T) -> S): S { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the sequence. */ public inline fun Sequence.sumBy(transform: (T) -> Int): Int { var sum: Int = 0 @@ -821,7 +822,7 @@ public inline fun Sequence.sumBy(transform: (T) -> Int): Int { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each element in the sequence. */ public inline fun Sequence.sumByDouble(transform: (T) -> Double): Double { var sum: Double = 0.0 @@ -900,9 +901,9 @@ public operator fun Sequence.minus(sequence: Sequence): Sequence { } /** - * Splits the original collection into pair of collections, - * where *first* collection contains elements for which [predicate] yielded `true`, - * while *second* collection contains elements for which [predicate] yielded `false`. + * Splits the original sequence into pair of lists, + * where *first* list contains elements for which [predicate] yielded `true`, + * while *second* list contains elements for which [predicate] yielded `false`. */ public inline fun Sequence.partition(predicate: (T) -> Boolean): Pair, List> { val first = ArrayList() @@ -953,7 +954,7 @@ public operator fun Sequence.plus(sequence: Sequence): Sequence { /** * Returns a sequence of pairs built from elements of both collections with same indexes. - * Resulting sequence has length of shortest input sequences. + * Resulting sequence has length of shortest input sequence. */ public fun Sequence.zip(sequence: Sequence): Sequence> { return MergingSequence(this, sequence) { t1, t2 -> t1 to t2 } @@ -1037,7 +1038,7 @@ public fun , R> Sequence<*>.filterIsInstanceTo(desti } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the sequence. */ @kotlin.jvm.JvmName("averageOfByte") public fun Sequence.average(): Double { @@ -1052,7 +1053,7 @@ public fun Sequence.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the sequence. */ @kotlin.jvm.JvmName("averageOfDouble") public fun Sequence.average(): Double { @@ -1067,7 +1068,7 @@ public fun Sequence.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the sequence. */ @kotlin.jvm.JvmName("averageOfFloat") public fun Sequence.average(): Double { @@ -1082,7 +1083,7 @@ public fun Sequence.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the sequence. */ @kotlin.jvm.JvmName("averageOfInt") public fun Sequence.average(): Double { @@ -1097,7 +1098,7 @@ public fun Sequence.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the sequence. */ @kotlin.jvm.JvmName("averageOfLong") public fun Sequence.average(): Double { @@ -1112,7 +1113,7 @@ public fun Sequence.average(): Double { } /** - * Returns an average value of elements in the collection. + * Returns an average value of elements in the sequence. */ @kotlin.jvm.JvmName("averageOfShort") public fun Sequence.average(): Double { @@ -1127,7 +1128,7 @@ public fun Sequence.average(): Double { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the sequence. */ @kotlin.jvm.JvmName("sumOfByte") public fun Sequence.sum(): Int { @@ -1140,7 +1141,7 @@ public fun Sequence.sum(): Int { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the sequence. */ @kotlin.jvm.JvmName("sumOfDouble") public fun Sequence.sum(): Double { @@ -1153,7 +1154,7 @@ public fun Sequence.sum(): Double { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the sequence. */ @kotlin.jvm.JvmName("sumOfFloat") public fun Sequence.sum(): Float { @@ -1166,7 +1167,7 @@ public fun Sequence.sum(): Float { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the sequence. */ @kotlin.jvm.JvmName("sumOfInt") public fun Sequence.sum(): Int { @@ -1179,7 +1180,7 @@ public fun Sequence.sum(): Int { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the sequence. */ @kotlin.jvm.JvmName("sumOfLong") public fun Sequence.sum(): Long { @@ -1192,7 +1193,7 @@ public fun Sequence.sum(): Long { } /** - * Returns the sum of all elements in the collection. + * Returns the sum of all elements in the sequence. */ @kotlin.jvm.JvmName("sumOfShort") public fun Sequence.sum(): Int { diff --git a/libraries/stdlib/src/generated/_Strings.kt b/libraries/stdlib/src/generated/_Strings.kt index bebb26f9a68..336ed95325f 100644 --- a/libraries/stdlib/src/generated/_Strings.kt +++ b/libraries/stdlib/src/generated/_Strings.kt @@ -13,14 +13,14 @@ import java.util.* import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js /** - * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection. + * Returns a character at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this char sequence. */ public fun CharSequence.elementAt(index: Int): Char { return get(index) } /** - * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection. + * Returns a character at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this string. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.elementAt(index: Int): Char { @@ -28,14 +28,14 @@ public fun String.elementAt(index: Int): Char { } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns a character at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this char sequence. */ public inline fun CharSequence.elementAtOrElse(index: Int, defaultValue: (Int) -> Char): Char { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns a character at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this string. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.elementAtOrElse(index: Int, defaultValue: (Int) -> Char): Char { @@ -43,14 +43,14 @@ public inline fun String.elementAtOrElse(index: Int, defaultValue: (Int) -> Char } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns a character at the given [index] or `null` if the [index] is out of bounds of this char sequence. */ public fun CharSequence.elementAtOrNull(index: Int): Char? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns a character at the given [index] or `null` if the [index] is out of bounds of this string. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.elementAtOrNull(index: Int): Char? { @@ -58,14 +58,14 @@ public fun String.elementAtOrNull(index: Int): Char? { } /** - * Returns the first character matching the given [predicate], or `null` if character was not found. + * Returns the first character matching the given [predicate], or `null` if no such character was found. */ public inline fun CharSequence.find(predicate: (Char) -> Boolean): Char? { return firstOrNull(predicate) } /** - * Returns the first element matching the given [predicate], or `null` if element was not found. + * Returns the first character matching the given [predicate], or `null` if no such character was found. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.find(predicate: (Char) -> Boolean): Char? { @@ -80,7 +80,7 @@ public inline fun CharSequence.findLast(predicate: (Char) -> Boolean): Char? { } /** - * Returns the last element matching the given [predicate], or `null` if no such element was found. + * Returns the last character matching the given [predicate], or `null` if no such character was found. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.findLast(predicate: (Char) -> Boolean): Char? { @@ -89,7 +89,7 @@ public inline fun String.findLast(predicate: (Char) -> Boolean): Char? { /** * Returns first character. - * @throws [NoSuchElementException] if the CharSequence is empty. + * @throws [NoSuchElementException] if the char sequence is empty. */ public fun CharSequence.first(): Char { if (isEmpty()) @@ -98,8 +98,8 @@ public fun CharSequence.first(): Char { } /** - * Returns first element. - * @throws [NoSuchElementException] if the collection is empty. + * Returns first character. + * @throws [NoSuchElementException] if the string is empty. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.first(): Char { @@ -118,8 +118,8 @@ public inline fun CharSequence.first(predicate: (Char) -> Boolean): Char { } /** - * Returns the first element matching the given [predicate]. - * @throws [NoSuchElementException] if no such element is found. + * Returns the first character matching the given [predicate]. + * @throws [NoSuchElementException] if no such character is found. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.first(predicate: (Char) -> Boolean): Char { @@ -128,14 +128,14 @@ public inline fun String.first(predicate: (Char) -> Boolean): Char { } /** - * Returns the first character, or `null` if CharSequence is empty. + * Returns the first character, or `null` if the char sequence is empty. */ public fun CharSequence.firstOrNull(): Char? { return if (isEmpty()) null else this[0] } /** - * Returns the first element, or `null` if the collection is empty. + * Returns the first character, or `null` if the string is empty. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.firstOrNull(): Char? { @@ -151,7 +151,7 @@ public inline fun CharSequence.firstOrNull(predicate: (Char) -> Boolean): Char? } /** - * Returns the first element matching the given [predicate], or `null` if element was not found. + * Returns the first character matching the given [predicate], or `null` if character was not found. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.firstOrNull(predicate: (Char) -> Boolean): Char? { @@ -160,14 +160,14 @@ public inline fun String.firstOrNull(predicate: (Char) -> Boolean): Char? { } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns a character at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this char sequence. */ public inline fun CharSequence.getOrElse(index: Int, defaultValue: (Int) -> Char): Char { return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) } /** - * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + * Returns a character at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this string. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.getOrElse(index: Int, defaultValue: (Int) -> Char): Char { @@ -175,14 +175,14 @@ public inline fun String.getOrElse(index: Int, defaultValue: (Int) -> Char): Cha } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns a character at the given [index] or `null` if the [index] is out of bounds of this char sequence. */ public fun CharSequence.getOrNull(index: Int): Char? { return if (index >= 0 && index <= lastIndex) get(index) else null } /** - * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + * Returns a character at the given [index] or `null` if the [index] is out of bounds of this string. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.getOrNull(index: Int): Char? { @@ -190,7 +190,7 @@ public fun String.getOrNull(index: Int): Char? { } /** - * Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the first character matching the given [predicate], or -1 if the char sequence does not contain such character. */ public inline fun CharSequence.indexOfFirst(predicate: (Char) -> Boolean): Int { for (index in indices) { @@ -202,7 +202,7 @@ public inline fun CharSequence.indexOfFirst(predicate: (Char) -> Boolean): Int { } /** - * Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the first character matching the given [predicate], or -1 if the string does not contain such character. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.indexOfFirst(predicate: (Char) -> Boolean): Int { @@ -215,7 +215,7 @@ public inline fun String.indexOfFirst(predicate: (Char) -> Boolean): Int { } /** - * Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the last character matching the given [predicate], or -1 if the char sequence does not contain such character. */ public inline fun CharSequence.indexOfLast(predicate: (Char) -> Boolean): Int { for (index in indices.reversed()) { @@ -227,7 +227,7 @@ public inline fun CharSequence.indexOfLast(predicate: (Char) -> Boolean): Int { } /** - * Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element. + * Returns index of the last character matching the given [predicate], or -1 if the string does not contain such character. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.indexOfLast(predicate: (Char) -> Boolean): Int { @@ -240,8 +240,8 @@ public inline fun String.indexOfLast(predicate: (Char) -> Boolean): Int { } /** - * "Returns the last character. - * @throws [NoSuchElementException] if the string is empty. + * Returns the last character. + * @throws [NoSuchElementException] if the char sequence is empty. */ public fun CharSequence.last(): Char { if (isEmpty()) @@ -250,8 +250,8 @@ public fun CharSequence.last(): Char { } /** - * Returns the last element. - * @throws [NoSuchElementException] if the collection is empty. + * Returns the last character. + * @throws [NoSuchElementException] if the string is empty. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.last(): Char { @@ -261,7 +261,7 @@ public fun String.last(): Char { } /** - * "Returns the last character matching the given [predicate]. + * Returns the last character matching the given [predicate]. * @throws [NoSuchElementException] if no such character is found. */ public inline fun CharSequence.last(predicate: (Char) -> Boolean): Char { @@ -278,8 +278,8 @@ public inline fun CharSequence.last(predicate: (Char) -> Boolean): Char { } /** - * Returns the last element matching the given [predicate]. - * @throws [NoSuchElementException] if no such element is found. + * Returns the last character matching the given [predicate]. + * @throws [NoSuchElementException] if no such character is found. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.last(predicate: (Char) -> Boolean): Char { @@ -296,14 +296,14 @@ public inline fun String.last(predicate: (Char) -> Boolean): Char { } /** - * Returns the last character, or `null` if the string is empty. + * Returns the last character, or `null` if the char sequence is empty. */ public fun CharSequence.lastOrNull(): Char? { return if (isEmpty()) null else this[length() - 1] } /** - * Returns the last element, or `null` if the collection is empty. + * Returns the last character, or `null` if the string is empty. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.lastOrNull(): Char? { @@ -324,7 +324,7 @@ public inline fun CharSequence.lastOrNull(predicate: (Char) -> Boolean): Char? { } /** - * Returns the last element matching the given [predicate], or `null` if no such element was found. + * Returns the last character matching the given [predicate], or `null` if no such character was found. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.lastOrNull(predicate: (Char) -> Boolean): Char? { @@ -338,7 +338,7 @@ public inline fun String.lastOrNull(predicate: (Char) -> Boolean): Char? { } /** - * Returns the single character, or throws an exception if the string is empty or has more than one character. + * Returns the single character, or throws an exception if the char sequence is empty or has more than one character. */ public fun CharSequence.single(): Char { return when (length()) { @@ -349,7 +349,7 @@ public fun CharSequence.single(): Char { } /** - * Returns the single element, or throws an exception if the collection is empty or has more than one element. + * Returns the single character, or throws an exception if the string is empty or has more than one character. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.single(): Char { @@ -378,7 +378,7 @@ public inline fun CharSequence.single(predicate: (Char) -> Boolean): Char { } /** - * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element. + * Returns the single character matching the given [predicate], or throws exception if there is no or more than one matching character. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.single(predicate: (Char) -> Boolean): Char { @@ -396,14 +396,14 @@ public inline fun String.single(predicate: (Char) -> Boolean): Char { } /** - * Returns the single character, or `null` if the string is empty or has more than one character. + * Returns single character, or `null` if the char sequence is empty or has more than one character. */ public fun CharSequence.singleOrNull(): Char? { return if (length() == 1) this[0] else null } /** - * Returns single element, or `null` if the collection is empty or has more than one element. + * Returns single character, or `null` if the string is empty or has more than one character. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.singleOrNull(): Char? { @@ -428,7 +428,7 @@ public inline fun CharSequence.singleOrNull(predicate: (Char) -> Boolean): Char? } /** - * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found. + * Returns the single character matching the given [predicate], or `null` if character was not found or more than one character was found. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.singleOrNull(predicate: (Char) -> Boolean): Char? { @@ -704,14 +704,14 @@ public fun String.reversed(): String { } /** - * Returns an [ArrayList] of all elements. + * Returns an [ArrayList] of all characters. */ public fun CharSequence.toArrayList(): ArrayList { return toCollection(ArrayList(length())) } /** - * Returns an [ArrayList] of all elements. + * Returns an [ArrayList] of all characters. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.toArrayList(): ArrayList { @@ -719,7 +719,7 @@ public fun String.toArrayList(): ArrayList { } /** - * Appends all elements to the given [collection]. + * Appends all characters to the given [collection]. */ public fun > CharSequence.toCollection(collection: C): C { for (item in this) { @@ -729,7 +729,7 @@ public fun > CharSequence.toCollection(collection } /** - * Appends all elements to the given [collection]. + * Appends all characters to the given [collection]. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun > String.toCollection(collection: C): C { @@ -740,14 +740,14 @@ public fun > String.toCollection(collection: C): } /** - * Returns a [HashSet] of all elements. + * Returns a [HashSet] of all characters. */ public fun CharSequence.toHashSet(): HashSet { return toCollection(HashSet(mapCapacity(length()))) } /** - * Returns a [HashSet] of all elements. + * Returns a [HashSet] of all characters. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.toHashSet(): HashSet { @@ -763,14 +763,14 @@ public fun String.toLinkedList(): LinkedList { } /** - * Returns a [List] containing all elements. + * Returns a [List] containing all characters. */ public fun CharSequence.toList(): List { return this.toArrayList() } /** - * Returns a [List] containing all elements. + * Returns a [List] containing all characters. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.toList(): List { @@ -788,8 +788,8 @@ public inline fun String.toMap(selector: (Char) -> K): Map { } /** - * Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection. - * If any two elements would have the same key returned by [selector] the last one gets added to the map. + * Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to characters of the given char sequence. + * If any two characters would have the same key returned by [selector] the last one gets added to the map. */ public inline fun CharSequence.toMap(selector: (Char) -> K, transform: (Char) -> V): Map { val capacity = (length()/.75f) + 1 @@ -801,8 +801,8 @@ public inline fun CharSequence.toMap(selector: (Char) -> K, transform: (C } /** - * Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection. - * If any two elements would have the same key returned by [selector] the last one gets added to the map. + * Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to characters of the given string. + * If any two characters would have the same key returned by [selector] the last one gets added to the map. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.toMap(selector: (Char) -> K, transform: (Char) -> V): Map { @@ -815,8 +815,9 @@ public inline fun String.toMap(selector: (Char) -> K, transform: (Char) - } /** - * Returns Map containing the values from the given collection indexed by [selector]. - * If any two elements would have the same key returned by [selector] the last one gets added to the map. + * Returns Map containing the characters from the given char sequence indexed by the key + * returned from [selector] function applied to each character. + * If any two characters would have the same key returned by [selector] the last one gets added to the map. */ public inline fun CharSequence.toMapBy(selector: (Char) -> K): Map { val capacity = (length()/.75f) + 1 @@ -828,8 +829,9 @@ public inline fun CharSequence.toMapBy(selector: (Char) -> K): Map } /** - * Returns Map containing the values from the given collection indexed by [selector]. - * If any two elements would have the same key returned by [selector] the last one gets added to the map. + * Returns Map containing the characters from the given string indexed by the key + * returned from [selector] function applied to each character. + * If any two characters would have the same key returned by [selector] the last one gets added to the map. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.toMapBy(selector: (Char) -> K): Map { @@ -842,14 +844,14 @@ public inline fun String.toMapBy(selector: (Char) -> K): Map { } /** - * Returns a [Set] of all elements. + * Returns a [Set] of all characters. */ public fun CharSequence.toSet(): Set { return toCollection(LinkedHashSet(mapCapacity(length()))) } /** - * Returns a [Set] of all elements. + * Returns a [Set] of all characters. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.toSet(): Set { @@ -857,14 +859,14 @@ public fun String.toSet(): Set { } /** - * Returns a [SortedSet] of all elements. + * Returns a [SortedSet] of all characters. */ public fun CharSequence.toSortedSet(): SortedSet { return toCollection(TreeSet()) } /** - * Returns a [SortedSet] of all elements. + * Returns a [SortedSet] of all characters. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.toSortedSet(): SortedSet { @@ -872,14 +874,14 @@ public fun String.toSortedSet(): SortedSet { } /** - * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection. + * Returns a single list of all elements yielded from results of [transform] function being invoked on each character of original char sequence. */ public inline fun CharSequence.flatMap(transform: (Char) -> Iterable): List { return flatMapTo(ArrayList(), transform) } /** - * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection. + * Returns a single list of all elements yielded from results of [transform] function being invoked on each character of original string. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.flatMap(transform: (Char) -> Iterable): List { @@ -887,7 +889,7 @@ public inline fun String.flatMap(transform: (Char) -> Iterable): List } /** - * Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination]. + * Appends all elements yielded from results of [transform] function being invoked on each character of original char sequence, to the given [destination]. */ public inline fun > CharSequence.flatMapTo(destination: C, transform: (Char) -> Iterable): C { for (element in this) { @@ -898,7 +900,7 @@ public inline fun > CharSequence.flatMapTo(destin } /** - * Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination]. + * Appends all elements yielded from results of [transform] function being invoked on each character of original string, to the given [destination]. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun > String.flatMapTo(destination: C, transform: (Char) -> Iterable): C { @@ -910,14 +912,14 @@ public inline fun > String.flatMapTo(destination: } /** - * Returns a map of the elements in original collection grouped by the result of given [toKey] function. + * Returns a map of the characters in original char sequence grouped by the result of given [toKey] function. */ public inline fun CharSequence.groupBy(toKey: (Char) -> K): Map> { return groupByTo(LinkedHashMap>(), toKey) } /** - * Returns a map of the elements in original collection grouped by the result of given [toKey] function. + * Returns a map of the characters in original string grouped by the result of given [toKey] function. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.groupBy(toKey: (Char) -> K): Map> { @@ -925,7 +927,7 @@ public inline fun String.groupBy(toKey: (Char) -> K): Map> { } /** - * Appends elements from original collection grouped by the result of given [toKey] function to the given [map]. + * Appends characters from original char sequence grouped by the result of given [toKey] function to the given [map]. */ public inline fun CharSequence.groupByTo(map: MutableMap>, toKey: (Char) -> K): Map> { for (element in this) { @@ -937,7 +939,7 @@ public inline fun CharSequence.groupByTo(map: MutableMap String.groupByTo(map: MutableMap>, toKey: (Char) -> K): Map> { @@ -950,14 +952,14 @@ public inline fun String.groupByTo(map: MutableMap>, to } /** - * Returns a list containing the results of applying the given [transform] function to each element of the original collection. + * Returns a list containing the results of applying the given [transform] function to each character of the original char sequence. */ public inline fun CharSequence.map(transform: (Char) -> R): List { return mapTo(ArrayList(length()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element of the original collection. + * Returns a list containing the results of applying the given [transform] function to each character of the original string. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.map(transform: (Char) -> R): List { @@ -965,14 +967,14 @@ public inline fun String.map(transform: (Char) -> R): List { } /** - * Returns a list containing the results of applying the given [transform] function to each element and its index of the original collection. + * Returns a list containing the results of applying the given [transform] function to each character and its index in the original char sequence. */ public inline fun CharSequence.mapIndexed(transform: (Int, Char) -> R): List { return mapIndexedTo(ArrayList(length()), transform) } /** - * Returns a list containing the results of applying the given [transform] function to each element and its index of the original collection. + * Returns a list containing the results of applying the given [transform] function to each character and its index in the original string. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.mapIndexed(transform: (Int, Char) -> R): List { @@ -980,7 +982,7 @@ public inline fun String.mapIndexed(transform: (Int, Char) -> R): List { } /** - * Appends transformed elements and their indices of the original collection using the given [transform] function + * Appends transformed characters and their indices in the original char sequence using the given [transform] function * to the given [destination]. */ public inline fun > CharSequence.mapIndexedTo(destination: C, transform: (Int, Char) -> R): C { @@ -991,7 +993,7 @@ public inline fun > CharSequence.mapIndexedTo(des } /** - * Appends transformed elements and their indices of the original collection using the given [transform] function + * Appends transformed characters and their indices in the original string using the given [transform] function * to the given [destination]. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) @@ -1003,7 +1005,7 @@ public inline fun > String.mapIndexedTo(destinati } /** - * Appends transformed elements of the original collection using the given [transform] function + * Appends transformed characters of the original char sequence using the given [transform] function * to the given [destination]. */ public inline fun > CharSequence.mapTo(destination: C, transform: (Char) -> R): C { @@ -1013,7 +1015,7 @@ public inline fun > CharSequence.mapTo(destinatio } /** - * Appends transformed elements of the original collection using the given [transform] function + * Appends transformed characters of the original string using the given [transform] function * to the given [destination]. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) @@ -1024,14 +1026,14 @@ public inline fun > String.mapTo(destination: C, } /** - * Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection. + * Returns a lazy [Iterable] of [IndexedValue] for each character of the original char sequence. */ public fun CharSequence.withIndex(): Iterable> { return IndexingIterable { iterator() } } /** - * Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection. + * Returns a lazy [Iterable] of [IndexedValue] for each character of the original string. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.withIndex(): Iterable> { @@ -1039,7 +1041,7 @@ public fun String.withIndex(): Iterable> { } /** - * Returns `true` if all elements match the given [predicate]. + * Returns `true` if all characters match the given [predicate]. */ public inline fun CharSequence.all(predicate: (Char) -> Boolean): Boolean { for (element in this) if (!predicate(element)) return false @@ -1047,7 +1049,7 @@ public inline fun CharSequence.all(predicate: (Char) -> Boolean): Boolean { } /** - * Returns `true` if all elements match the given [predicate]. + * Returns `true` if all characters match the given [predicate]. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.all(predicate: (Char) -> Boolean): Boolean { @@ -1056,7 +1058,7 @@ public inline fun String.all(predicate: (Char) -> Boolean): Boolean { } /** - * Returns `true` if collection has at least one element. + * Returns `true` if char sequence has at least one character. */ public fun CharSequence.any(): Boolean { for (element in this) return true @@ -1064,7 +1066,7 @@ public fun CharSequence.any(): Boolean { } /** - * Returns `true` if collection has at least one element. + * Returns `true` if string has at least one character. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.any(): Boolean { @@ -1073,7 +1075,7 @@ public fun String.any(): Boolean { } /** - * Returns `true` if at least one element matches the given [predicate]. + * Returns `true` if at least one character matches the given [predicate]. */ public inline fun CharSequence.any(predicate: (Char) -> Boolean): Boolean { for (element in this) if (predicate(element)) return true @@ -1081,7 +1083,7 @@ public inline fun CharSequence.any(predicate: (Char) -> Boolean): Boolean { } /** - * Returns `true` if at least one element matches the given [predicate]. + * Returns `true` if at least one character matches the given [predicate]. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.any(predicate: (Char) -> Boolean): Boolean { @@ -1090,14 +1092,14 @@ public inline fun String.any(predicate: (Char) -> Boolean): Boolean { } /** - * Returns the length of this string. + * Returns the length of this char sequence. */ public fun CharSequence.count(): Int { return length() } /** - * Returns the number of elements in this collection. + * Returns the number of characters in this string. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.count(): Int { @@ -1105,7 +1107,7 @@ public fun String.count(): Int { } /** - * Returns the number of elements matching the given [predicate]. + * Returns the number of characters matching the given [predicate]. */ public inline fun CharSequence.count(predicate: (Char) -> Boolean): Int { var count = 0 @@ -1114,7 +1116,7 @@ public inline fun CharSequence.count(predicate: (Char) -> Boolean): Int { } /** - * Returns the number of elements matching the given [predicate]. + * Returns the number of characters matching the given [predicate]. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.count(predicate: (Char) -> Boolean): Int { @@ -1124,7 +1126,7 @@ public inline fun String.count(predicate: (Char) -> Boolean): Int { } /** - * Accumulates value starting with [initial] value and applying [operation] from left to right to current accumulator value and each element. + * Accumulates value starting with [initial] value and applying [operation] from left to right to current accumulator value and each character. */ public inline fun CharSequence.fold(initial: R, operation: (R, Char) -> R): R { var accumulator = initial @@ -1133,7 +1135,7 @@ public inline fun CharSequence.fold(initial: R, operation: (R, Char) -> R): } /** - * Accumulates value starting with [initial] value and applying [operation] from left to right to current accumulator value and each element. + * Accumulates value starting with [initial] value and applying [operation] from left to right to current accumulator value and each character. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.fold(initial: R, operation: (R, Char) -> R): R { @@ -1143,7 +1145,7 @@ public inline fun String.fold(initial: R, operation: (R, Char) -> R): R { } /** - * Accumulates value starting with [initial] value and applying [operation] from right to left to each element and current accumulator value. + * Accumulates value starting with [initial] value and applying [operation] from right to left to each character and current accumulator value. */ public inline fun CharSequence.foldRight(initial: R, operation: (Char, R) -> R): R { var index = lastIndex @@ -1155,7 +1157,7 @@ public inline fun CharSequence.foldRight(initial: R, operation: (Char, R) -> } /** - * Accumulates value starting with [initial] value and applying [operation] from right to left to each element and current accumulator value. + * Accumulates value starting with [initial] value and applying [operation] from right to left to each character and current accumulator value. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.foldRight(initial: R, operation: (Char, R) -> R): R { @@ -1168,14 +1170,14 @@ public inline fun String.foldRight(initial: R, operation: (Char, R) -> R): R } /** - * Performs the given [operation] on each element. + * Performs the given [operation] on each character. */ public inline fun CharSequence.forEach(operation: (Char) -> Unit): Unit { for (element in this) operation(element) } /** - * Performs the given [operation] on each element. + * Performs the given [operation] on each character. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.forEach(operation: (Char) -> Unit): Unit { @@ -1183,7 +1185,7 @@ public inline fun String.forEach(operation: (Char) -> Unit): Unit { } /** - * Performs the given [operation] on each element, providing sequential index with the element. + * Performs the given [operation] on each character, providing sequential index with the character. */ public inline fun CharSequence.forEachIndexed(operation: (Int, Char) -> Unit): Unit { var index = 0 @@ -1191,7 +1193,7 @@ public inline fun CharSequence.forEachIndexed(operation: (Int, Char) -> Unit): U } /** - * Performs the given [operation] on each element, providing sequential index with the element. + * Performs the given [operation] on each character, providing sequential index with the character. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.forEachIndexed(operation: (Int, Char) -> Unit): Unit { @@ -1200,7 +1202,7 @@ public inline fun String.forEachIndexed(operation: (Int, Char) -> Unit): Unit { } /** - * Returns the largest element or `null` if there are no elements. + * Returns the largest character or `null` if there are no characters. */ public fun CharSequence.max(): Char? { if (isEmpty()) return null @@ -1213,7 +1215,7 @@ public fun CharSequence.max(): Char? { } /** - * Returns the largest element or `null` if there are no elements. + * Returns the largest character or `null` if there are no characters. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.max(): Char? { @@ -1227,7 +1229,7 @@ public fun String.max(): Char? { } /** - * Returns the first element yielding the largest value of the given function or `null` if there are no elements. + * Returns the first character yielding the largest value of the given function or `null` if there are no characters. */ public inline fun > CharSequence.maxBy(f: (Char) -> R): Char? { if (isEmpty()) return null @@ -1245,7 +1247,7 @@ public inline fun > CharSequence.maxBy(f: (Char) -> R): Char? } /** - * Returns the first element yielding the largest value of the given function or `null` if there are no elements. + * Returns the first character yielding the largest value of the given function or `null` if there are no characters. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun > String.maxBy(f: (Char) -> R): Char? { @@ -1264,7 +1266,7 @@ public inline fun > String.maxBy(f: (Char) -> R): Char? { } /** - * Returns the smallest element or `null` if there are no elements. + * Returns the smallest character or `null` if there are no characters. */ public fun CharSequence.min(): Char? { if (isEmpty()) return null @@ -1277,7 +1279,7 @@ public fun CharSequence.min(): Char? { } /** - * Returns the smallest element or `null` if there are no elements. + * Returns the smallest character or `null` if there are no characters. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.min(): Char? { @@ -1291,7 +1293,7 @@ public fun String.min(): Char? { } /** - * Returns the first element yielding the smallest value of the given function or `null` if there are no elements. + * Returns the first character yielding the smallest value of the given function or `null` if there are no characters. */ public inline fun > CharSequence.minBy(f: (Char) -> R): Char? { if (isEmpty()) return null @@ -1309,7 +1311,7 @@ public inline fun > CharSequence.minBy(f: (Char) -> R): Char? } /** - * Returns the first element yielding the smallest value of the given function or `null` if there are no elements. + * Returns the first character yielding the smallest value of the given function or `null` if there are no characters. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun > String.minBy(f: (Char) -> R): Char? { @@ -1328,7 +1330,7 @@ public inline fun > String.minBy(f: (Char) -> R): Char? { } /** - * Returns `true` if collection has no elements. + * Returns `true` if the char sequence has no characters. */ public fun CharSequence.none(): Boolean { for (element in this) return false @@ -1336,7 +1338,7 @@ public fun CharSequence.none(): Boolean { } /** - * Returns `true` if collection has no elements. + * Returns `true` if the string has no characters. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.none(): Boolean { @@ -1345,7 +1347,7 @@ public fun String.none(): Boolean { } /** - * Returns `true` if no elements match the given [predicate]. + * Returns `true` if no characters match the given [predicate]. */ public inline fun CharSequence.none(predicate: (Char) -> Boolean): Boolean { for (element in this) if (predicate(element)) return false @@ -1353,7 +1355,7 @@ public inline fun CharSequence.none(predicate: (Char) -> Boolean): Boolean { } /** - * Returns `true` if no elements match the given [predicate]. + * Returns `true` if no characters match the given [predicate]. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.none(predicate: (Char) -> Boolean): Boolean { @@ -1362,7 +1364,7 @@ public inline fun String.none(predicate: (Char) -> Boolean): Boolean { } /** - * Accumulates value starting with the first element and applying [operation] from left to right to current accumulator value and each element. + * Accumulates value starting with the first character and applying [operation] from left to right to current accumulator value and each character. */ public inline fun CharSequence.reduce(operation: (Char, Char) -> Char): Char { val iterator = this.iterator() @@ -1375,7 +1377,7 @@ public inline fun CharSequence.reduce(operation: (Char, Char) -> Char): Char { } /** - * Accumulates value starting with the first element and applying [operation] from left to right to current accumulator value and each element. + * Accumulates value starting with the first character and applying [operation] from left to right to current accumulator value and each character. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.reduce(operation: (Char, Char) -> Char): Char { @@ -1389,7 +1391,7 @@ public inline fun String.reduce(operation: (Char, Char) -> Char): Char { } /** - * Accumulates value starting with last element and applying [operation] from right to left to each element and current accumulator value. + * Accumulates value starting with last character and applying [operation] from right to left to each character and current accumulator value. */ public inline fun CharSequence.reduceRight(operation: (Char, Char) -> Char): Char { var index = lastIndex @@ -1402,7 +1404,7 @@ public inline fun CharSequence.reduceRight(operation: (Char, Char) -> Char): Cha } /** - * Accumulates value starting with last element and applying [operation] from right to left to each element and current accumulator value. + * Accumulates value starting with last character and applying [operation] from right to left to each character and current accumulator value. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.reduceRight(operation: (Char, Char) -> Char): Char { @@ -1416,7 +1418,7 @@ public inline fun String.reduceRight(operation: (Char, Char) -> Char): Char { } /** - * Returns the sum of all values produced by [transform] function from characters in the string. + * Returns the sum of all values produced by [transform] function applied to each character in the char sequence. */ public inline fun CharSequence.sumBy(transform: (Char) -> Int): Int { var sum: Int = 0 @@ -1427,7 +1429,7 @@ public inline fun CharSequence.sumBy(transform: (Char) -> Int): Int { } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each character in the string. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.sumBy(transform: (Char) -> Int): Int { @@ -1439,7 +1441,7 @@ public inline fun String.sumBy(transform: (Char) -> Int): Int { } /** - * Returns the sum of all values produced by [transform] function from characters in the string. + * Returns the sum of all values produced by [transform] function applied to each character in the char sequence. */ public inline fun CharSequence.sumByDouble(transform: (Char) -> Double): Double { var sum: Double = 0.0 @@ -1450,7 +1452,7 @@ public inline fun CharSequence.sumByDouble(transform: (Char) -> Double): Double } /** - * Returns the sum of all values produced by [transform] function from elements in the collection. + * Returns the sum of all values produced by [transform] function applied to each character in the string. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.sumByDouble(transform: (Char) -> Double): Double { @@ -1462,7 +1464,7 @@ public inline fun String.sumByDouble(transform: (Char) -> Double): Double { } /** - * Splits the original string into pair of strings, + * Splits the original char sequence into pair of strings, * where *first* string contains characters for which [predicate] yielded `true`, * while *second* string contains characters for which [predicate] yielded `false`. */ @@ -1480,9 +1482,9 @@ public inline fun CharSequence.partition(predicate: (Char) -> Boolean): Pair Boolean): Pair { @@ -1499,14 +1501,14 @@ public inline fun String.partition(predicate: (Char) -> Boolean): Pair> { return zip(other) { c1, c2 -> c1 to c2 } } /** - * Returns a list of pairs built from characters of both strings with same indexes. List has length of shortest collection. + * Returns a list of pairs built from characters of both char sequences with same indexes. List has length of shortest char sequence. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.zip(other: String): List> { @@ -1514,7 +1516,7 @@ public fun String.zip(other: String): List> { } /** - * Returns a list of values built from characters of both strings with same indexes using provided [transform]. List has length of shortest string. + * Returns a list of values built from characters of both char sequences with same indexes using provided [transform]. List has length of shortest char sequence. */ public inline fun CharSequence.zip(other: String, transform: (Char, Char) -> V): List { val length = Math.min(this.length(), other.length()) @@ -1526,7 +1528,7 @@ public inline fun CharSequence.zip(other: String, transform: (Char, Char) -> } /** - * Returns a list of values built from characters of both strings with same indexes using provided [transform]. List has length of shortest string. + * Returns a list of values built from characters of both char sequences with same indexes using provided [transform]. List has length of shortest char sequence. */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.zip(other: String, transform: (Char, Char) -> V): List { diff --git a/libraries/stdlib/src/kotlin/text/Strings.kt b/libraries/stdlib/src/kotlin/text/Strings.kt index a3afca6f056..eb3485041c5 100644 --- a/libraries/stdlib/src/kotlin/text/Strings.kt +++ b/libraries/stdlib/src/kotlin/text/Strings.kt @@ -132,17 +132,17 @@ public fun CharSequence.padEnd(length: Int, padChar: Char = ' '): String { } /** - * Returns `true` if this nullable string is either `null` or empty. + * Returns `true` if this nullable char sequence is either `null` or empty. */ public fun CharSequence?.isNullOrEmpty(): Boolean = this == null || this.length() == 0 /** - * Returns `true` if this string is empty (contains no characters). + * Returns `true` if this char sequence is empty (contains no characters). */ public fun CharSequence.isEmpty(): Boolean = length() == 0 /** - * Returns `true` if this string is not empty. + * Returns `true` if this char sequence is not empty. */ public fun CharSequence.isNotEmpty(): Boolean = length() > 0 @@ -151,12 +151,12 @@ public fun CharSequence.isNotEmpty(): Boolean = length() > 0 /** - * Returns `true` if this string is not empty and contains some characters except of whitespace characters. + * Returns `true` if this char sequence is not empty and contains some characters except of whitespace characters. */ public fun CharSequence.isNotBlank(): Boolean = !isBlank() /** - * Returns `true` if this nullable string is either `null` or empty or consists solely of whitespace characters. + * Returns `true` if this nullable char sequence is either `null` or empty or consists solely of whitespace characters. */ public fun CharSequence?.isNullOrBlank(): Boolean = this == null || this.isBlank() @@ -175,13 +175,13 @@ public operator fun CharSequence.iterator(): CharIterator = object : CharIterato public fun String?.orEmpty(): String = this ?: "" /** - * Returns the range of valid character indices for this string. + * Returns the range of valid character indices for this char sequence. */ public val CharSequence.indices: IntRange get() = 0..length() - 1 /** - * Returns the index of the last character in the String or -1 if the String is empty. + * Returns the index of the last character in the char sequence or -1 if it is empty. */ public val CharSequence.lastIndex: Int get() = this.length() - 1 @@ -529,7 +529,7 @@ public fun CharSequence.replaceFirst(regex: Regex, replacement: String): String /** - * Returns `true` if this string matches the given regular expression. + * Returns `true` if this char sequence matches the given regular expression. */ public fun CharSequence.matches(regex: Regex): Boolean = regex.matches(this) @@ -551,13 +551,13 @@ internal fun CharSequence.regionMatchesImpl(thisOffset: Int, other: CharSequence } /** - * Returns `true` if this string starts with the specified character. + * Returns `true` if this char sequence starts with the specified character. */ public fun CharSequence.startsWith(char: Char, ignoreCase: Boolean = false): Boolean = this.length() > 0 && this[0].equals(char, ignoreCase) /** - * Returns `true` if this string ends with the specified character. + * Returns `true` if this char sequence ends with the specified character. */ public fun CharSequence.endsWith(char: Char, ignoreCase: Boolean = false): Boolean = this.length() > 0 && this[lastIndex].equals(char, ignoreCase) diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Aggregates.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Aggregates.kt index 39f1cbdf13b..28aed9c6d1f 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Aggregates.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Aggregates.kt @@ -1,13 +1,15 @@ package templates import templates.Family.* +import templates.DocExtensions.element +import templates.DocExtensions.collection fun aggregates(): List { val templates = arrayListOf() templates add f("all(predicate: (T) -> Boolean)") { inline(true) - doc { "Returns `true` if all elements match the given [predicate]." } + doc { f -> "Returns `true` if all ${f.element}s match the given [predicate]." } returns("Boolean") body { """ @@ -22,7 +24,7 @@ fun aggregates(): List { templates add f("none(predicate: (T) -> Boolean)") { inline(true) - doc { "Returns `true` if no elements match the given [predicate]." } + doc { f -> "Returns `true` if no ${f.element}s match the given [predicate]." } returns("Boolean") body { """ @@ -35,7 +37,7 @@ fun aggregates(): List { } templates add f("none()") { - doc { "Returns `true` if collection has no elements." } + doc { f -> "Returns `true` if the ${f.collection} has no ${f.element}s." } returns("Boolean") body { """ @@ -50,7 +52,7 @@ fun aggregates(): List { templates add f("any(predicate: (T) -> Boolean)") { inline(true) - doc { "Returns `true` if at least one element matches the given [predicate]." } + doc { f -> "Returns `true` if at least one ${f.element} matches the given [predicate]." } returns("Boolean") body { """ @@ -63,7 +65,7 @@ fun aggregates(): List { } templates add f("any()") { - doc { "Returns `true` if collection has at least one element." } + doc { f -> "Returns `true` if ${f.collection} has at least one ${f.element}." } returns("Boolean") body { """ @@ -78,7 +80,7 @@ fun aggregates(): List { templates add f("count(predicate: (T) -> Boolean)") { inline(true) - doc { "Returns the number of elements matching the given [predicate]." } + doc { f -> "Returns the number of ${f.element}s matching the given [predicate]." } returns("Int") body { """ @@ -92,7 +94,7 @@ fun aggregates(): List { } templates add f("count()") { - doc { "Returns the number of elements in this collection." } + doc { f -> "Returns the number of ${f.element}s in this ${f.collection}." } returns("Int") body { """ @@ -102,7 +104,7 @@ fun aggregates(): List { """ } deprecate(Strings) { forBinaryCompatibility } - doc(CharSequences) { "Returns the length of this string."} + doc(CharSequences) { "Returns the length of this char sequence."} body(CharSequences, Strings) { "return length()" } @@ -115,8 +117,7 @@ fun aggregates(): List { inline(true) include(CharSequences, Strings) deprecate(Strings) { forBinaryCompatibility } - doc { "Returns the sum of all values produced by [transform] function from elements in the collection." } - doc(CharSequences) { "Returns the sum of all values produced by [transform] function from characters in the string." } + doc { f -> "Returns the sum of all values produced by [transform] function applied to each ${f.element} in the ${f.collection}." } returns("Int") body { """ @@ -133,8 +134,7 @@ fun aggregates(): List { inline(true) include(CharSequences, Strings) deprecate(Strings) { forBinaryCompatibility } - doc { "Returns the sum of all values produced by [transform] function from elements in the collection." } - doc(CharSequences) { "Returns the sum of all values produced by [transform] function from characters in the string." } + doc { f -> "Returns the sum of all values produced by [transform] function applied to each ${f.element} in the ${f.collection}." } returns("Double") body { """ @@ -148,7 +148,7 @@ fun aggregates(): List { } templates add f("min()") { - doc { "Returns the smallest element or `null` if there are no elements." } + doc { f -> "Returns the smallest ${f.element} or `null` if there are no ${f.element}s." } returns("T?") exclude(PrimitiveType.Boolean) typeParam("T : Comparable") @@ -182,7 +182,7 @@ fun aggregates(): List { templates add f("minBy(f: (T) -> R)") { inline(true) - doc { "Returns the first element yielding the smallest value of the given function or `null` if there are no elements." } + doc { f -> "Returns the first ${f.element} yielding the smallest value of the given function or `null` if there are no ${f.element}s." } typeParam("R : Comparable") typeParam("T : Any") returns("T?") @@ -228,7 +228,7 @@ fun aggregates(): List { inline(true) only(Maps) - doc { "Returns the first element yielding the smallest value of the given function or `null` if there are no elements." } + doc { "Returns the first map entry yielding the smallest value of the given function or `null` if there are no entries." } typeParam("R : Comparable") returns("T?") body { @@ -252,7 +252,7 @@ fun aggregates(): List { } templates add f("max()") { - doc { "Returns the largest element or `null` if there are no elements." } + doc { f -> "Returns the largest ${f.element} or `null` if there are no ${f.element}s." } returns("T?") exclude(PrimitiveType.Boolean) typeParam("T : Comparable") @@ -288,7 +288,7 @@ fun aggregates(): List { templates add f("maxBy(f: (T) -> R)") { inline(true) - doc { "Returns the first element yielding the largest value of the given function or `null` if there are no elements." } + doc { f -> "Returns the first ${f.element} yielding the largest value of the given function or `null` if there are no ${f.element}s." } typeParam("R : Comparable") typeParam("T : Any") returns("T?") @@ -334,7 +334,7 @@ fun aggregates(): List { inline(true) only(Maps) - doc { "Returns the first element yielding the largest value of the given function or `null` if there are no elements." } + doc { "Returns the first map entry yielding the largest value of the given function or `null` if there are no entries." } typeParam("R : Comparable") returns("T?") body { @@ -362,7 +362,7 @@ fun aggregates(): List { deprecate(Strings) { forBinaryCompatibility } include(CharSequences, Strings) - doc { "Accumulates value starting with [initial] value and applying [operation] from left to right to current accumulator value and each element." } + doc { f -> "Accumulates value starting with [initial] value and applying [operation] from left to right to current accumulator value and each ${f.element}." } typeParam("R") returns("R") body { @@ -379,7 +379,7 @@ fun aggregates(): List { deprecate(Strings) { forBinaryCompatibility } only(CharSequences, Strings, Lists, ArraysOfObjects, ArraysOfPrimitives) - doc { "Accumulates value starting with [initial] value and applying [operation] from right to left to each element and current accumulator value." } + doc { f -> "Accumulates value starting with [initial] value and applying [operation] from right to left to each ${f.element} and current accumulator value." } typeParam("R") returns("R") body { @@ -401,7 +401,7 @@ fun aggregates(): List { include(CharSequences, Strings) exclude(ArraysOfObjects, Iterables, Sequences) - doc { "Accumulates value starting with the first element and applying [operation] from left to right to current accumulator value and each element." } + doc { f -> "Accumulates value starting with the first ${f.element} and applying [operation] from left to right to current accumulator value and each ${f.element}." } returns("T") body { """ @@ -421,7 +421,7 @@ fun aggregates(): List { inline(true) only(ArraysOfObjects, Iterables, Sequences) - doc { "Accumulates value starting with the first element and applying [operation] from left to right to current accumulator value and each element." } + doc { f -> "Accumulates value starting with the first ${f.element} and applying [operation] from left to right to current accumulator value and each ${f.element}." } typeParam("S") typeParam("T: S") returns("S") @@ -444,7 +444,7 @@ fun aggregates(): List { deprecate(Strings) { forBinaryCompatibility } only(CharSequences, Strings, ArraysOfPrimitives) - doc { "Accumulates value starting with last element and applying [operation] from right to left to each element and current accumulator value." } + doc { f -> "Accumulates value starting with last ${f.element} and applying [operation] from right to left to each ${f.element} and current accumulator value." } returns("T") body { """ @@ -465,7 +465,7 @@ fun aggregates(): List { inline(true) only(Lists, ArraysOfObjects) - doc { "Accumulates value starting with last element and applying [operation] from right to left to each element and current accumulator value." } + doc { f -> "Accumulates value starting with last ${f.element} and applying [operation] from right to left to each ${f.element} and current accumulator value." } typeParam("S") typeParam("T: S") returns("S") @@ -487,7 +487,7 @@ fun aggregates(): List { templates add f("forEach(operation: (T) -> Unit)") { inline(true) - doc { "Performs the given [operation] on each element." } + doc { f -> "Performs the given [operation] on each ${f.element}." } returns("Unit") body { """ @@ -502,7 +502,7 @@ fun aggregates(): List { inline(true) deprecate(Strings) { forBinaryCompatibility } include(CharSequences, Strings) - doc { "Performs the given [operation] on each element, providing sequential index with the element." } + doc { f -> "Performs the given [operation] on each ${f.element}, providing sequential index with the ${f.element}." } returns("Unit") body { """ diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/DocExtensions.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/DocExtensions.kt new file mode 100644 index 00000000000..bff2e551955 --- /dev/null +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/DocExtensions.kt @@ -0,0 +1,32 @@ +package templates + +import templates.Family.* + +object DocExtensions { + + val Family.element: String + get() = when (this) { + Strings, CharSequences -> "character" + Maps -> "entry" + else -> "element" + } + + val Family.collection: String + get() = when (this) { + CharSequences -> "char sequence" + Strings -> "string" + Sequences -> "sequence" + Maps -> "map" + ArraysOfObjects, ArraysOfPrimitives, InvariantArraysOfObjects -> "array" + else -> "collection" + } + + val Family.mapResult: String + get() = when (this) { + Sequences -> "sequence" + else -> "list" + } + + fun String.prefixWithArticle() = (if ("aeiou".any { this.startsWith(it, ignoreCase = true) }) "an " else "a ").concat(this) + +} diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Elements.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Elements.kt index 0ea6cdd6882..f05f5f1f8e0 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Elements.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Elements.kt @@ -1,15 +1,20 @@ package templates import templates.Family.* +import templates.DocExtensions.element +import templates.DocExtensions.collection +import templates.DocExtensions.prefixWithArticle + fun elements(): List { val templates = arrayListOf() + templates add f("contains(element: T)") { operator(true) only(Iterables, Sequences, ArraysOfObjects, ArraysOfPrimitives) - doc { "Returns `true` if [element] is found in the collection." } + doc { f -> "Returns `true` if [element] is found in the ${f.collection}." } customSignature(Iterables, ArraysOfObjects, Sequences) { "contains(element: @kotlin.internal.NoInfer T)" } returns("Boolean") body(Iterables) { @@ -41,9 +46,9 @@ fun elements(): List { templates add f("containsRaw(element: Any?)") { only(Iterables, Sequences, ArraysOfObjects) - doc { + doc { f -> """ - Returns `true` if [element] is found in the collection. + Returns `true` if [element] is found in the ${f.collection}. Allows to overcome type-safety restriction of `contains` that requires to pass an element of type `T`. """ } @@ -56,7 +61,7 @@ fun elements(): List { templates add f("indexOf(element: T)") { only(Iterables, Sequences, ArraysOfObjects, ArraysOfPrimitives) - doc { "Returns first index of [element], or -1 if the collection does not contain element." } + doc { f -> "Returns first index of [element], or -1 if the ${f.collection} does not contain element." } customSignature(Iterables, ArraysOfObjects, Sequences) { "indexOf(element: @kotlin.internal.NoInfer T)" } returns("Int") body { f -> @@ -116,9 +121,9 @@ fun elements(): List { templates add f("indexOfRaw(element: Any?)") { only(Iterables, Sequences, ArraysOfObjects, Lists) - doc { + doc { f -> """ - Returns first index of [element], or -1 if the collection does not contain element. + Returns first index of [element], or -1 if the ${f.collection} does not contain element. Allows to overcome type-safety restriction of `indexOf` that requires to pass an element of type `T`. """ } @@ -132,7 +137,7 @@ fun elements(): List { templates add f("lastIndexOf(element: T)") { only(Iterables, Sequences, ArraysOfObjects, ArraysOfPrimitives) - doc { "Returns last index of [element], or -1 if the collection does not contain element." } + doc { f -> "Returns last index of [element], or -1 if the ${f.collection} does not contain element." } customSignature(Iterables, ArraysOfObjects, Sequences) { "lastIndexOf(element: @kotlin.internal.NoInfer T)" } returns("Int") body { f -> @@ -193,9 +198,9 @@ fun elements(): List { templates add f("lastIndexOfRaw(element: Any?)") { only(Iterables, Sequences, ArraysOfObjects, Lists) - doc { + doc { f -> """ - Returns last index of [element], or -1 if the collection does not contain element. + Returns last index of [element], or -1 if the ${f.collection} does not contain element. Allows to overcome type-safety restriction of `lastIndexOf` that requires to pass an element of type `T`. """ } @@ -210,7 +215,7 @@ fun elements(): List { templates add f("indexOfFirst(predicate: (T) -> Boolean)") { inline(true) - doc { "Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element." } + doc { f -> "Returns index of the first ${f.element} matching the given [predicate], or -1 if the ${f.collection} does not contain such ${f.element}." } returns("Int") body { """ @@ -240,7 +245,7 @@ fun elements(): List { templates add f("indexOfLast(predicate: (T) -> Boolean)") { inline(true) - doc { "Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element." } + doc { f -> "Returns index of the last ${f.element} matching the given [predicate], or -1 if the ${f.collection} does not contain such ${f.element}." } returns("Int") body { """ @@ -270,7 +275,7 @@ fun elements(): List { templates add f("elementAt(index: Int)") { val index = '$' + "index" - doc { "Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection." } + doc { f -> "Returns ${f.element.prefixWithArticle()} at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this ${f.collection}." } returns("T") body { """ @@ -294,7 +299,7 @@ fun elements(): List { } templates add f("elementAtOrElse(index: Int, defaultValue: (Int) -> T)") { - doc { "Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection." } + doc { f -> "Returns ${f.element.prefixWithArticle()} at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this ${f.collection}." } returns("T") body { """ @@ -336,7 +341,7 @@ fun elements(): List { } templates add f("getOrElse(index: Int, defaultValue: (Int) -> T)") { - doc { "Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection." } + doc { f -> "Returns ${f.element.prefixWithArticle()} at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this ${f.collection}." } returns("T") inline(true) deprecate(Strings) { forBinaryCompatibility } @@ -350,7 +355,7 @@ fun elements(): List { templates add f("elementAtOrNull(index: Int)") { - doc { "Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection." } + doc { f -> "Returns ${f.element.prefixWithArticle()} at the given [index] or `null` if the [index] is out of bounds of this ${f.collection}." } returns("T?") body { """ @@ -391,7 +396,7 @@ fun elements(): List { } templates add f("getOrNull(index: Int)") { - doc { "Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection." } + doc { f -> "Returns ${f.element.prefixWithArticle()} at the given [index] or `null` if the [index] is out of bounds of this ${f.collection}." } returns("T?") deprecate(Strings) { forBinaryCompatibility } only(CharSequences, Strings, Lists, ArraysOfObjects, ArraysOfPrimitives) @@ -404,11 +409,8 @@ fun elements(): List { templates add f("first()") { - doc { """Returns first element. - @throws [NoSuchElementException] if the collection is empty. - """ } - doc(CharSequences) { """Returns first character. - @throws [NoSuchElementException] if the CharSequence is empty. + doc { f -> """Returns first ${f.element}. + @throws [NoSuchElementException] if the ${f.collection} is empty. """ } returns("T") body { @@ -447,8 +449,7 @@ fun elements(): List { } } templates add f("firstOrNull()") { - doc { "Returns the first element, or `null` if the collection is empty." } - doc(CharSequences) { "Returns the first character, or `null` if CharSequence is empty." } + doc { f -> "Returns the first ${f.element}, or `null` if the ${f.collection} is empty." } returns("T?") body { """ @@ -489,10 +490,8 @@ fun elements(): List { deprecate(Strings) { forBinaryCompatibility } include(CharSequences, Strings) - doc { """Returns the first element matching the given [predicate]. - @throws [NoSuchElementException] if no such element is found.""" } - doc(CharSequences) { """Returns the first character matching the given [predicate]. - @throws [NoSuchElementException] if no such character is found.""" } + doc { f -> """Returns the first ${f.element} matching the given [predicate]. + @throws [NoSuchElementException] if no such ${f.element} is found.""" } returns("T") body { """ @@ -507,8 +506,7 @@ fun elements(): List { deprecate(Strings) { forBinaryCompatibility } include(CharSequences, Strings) - doc { "Returns the first element matching the given [predicate], or `null` if element was not found." } - doc(CharSequences) { "Returns the first character matching the given [predicate], or `null` if character was not found." } + doc { f -> "Returns the first ${f.element} matching the given [predicate], or `null` if ${f.element} was not found." } returns("T?") body { """ @@ -522,17 +520,14 @@ fun elements(): List { inline(true) deprecate(Strings) { forBinaryCompatibility } include(CharSequences, Strings) - doc { "Returns the first element matching the given [predicate], or `null` if element was not found." } - doc(CharSequences) { "Returns the first character matching the given [predicate], or `null` if character was not found." } + doc { f -> "Returns the first ${f.element} matching the given [predicate], or `null` if no such ${f.element} was found." } returns("T?") body { "return firstOrNull(predicate)"} } templates add f("last()") { - doc { """Returns the last element. - @throws [NoSuchElementException] if the collection is empty.""" } - doc(CharSequences) { """"Returns the last character. - @throws [NoSuchElementException] if the string is empty.""" } + doc { f -> """Returns the last ${f.element}. + @throws [NoSuchElementException] if the ${f.collection} is empty.""" } returns("T") body { """ @@ -577,8 +572,7 @@ fun elements(): List { } templates add f("lastOrNull()") { - doc { "Returns the last element, or `null` if the collection is empty." } - doc(CharSequences) { "Returns the last character, or `null` if the string is empty." } + doc { f -> "Returns the last ${f.element}, or `null` if the ${f.collection} is empty." } returns("T?") body { """ @@ -625,10 +619,8 @@ fun elements(): List { deprecate(Strings) { forBinaryCompatibility } include(CharSequences, Strings) - doc { """Returns the last element matching the given [predicate]. - @throws [NoSuchElementException] if no such element is found.""" } - doc(CharSequences) { """"Returns the last character matching the given [predicate]. - @throws [NoSuchElementException] if no such character is found.""" } + doc { f -> """Returns the last ${f.element} matching the given [predicate]. + @throws [NoSuchElementException] if no such ${f.element} is found.""" } returns("T") body { f -> (if (f == Iterables) @@ -666,8 +658,7 @@ fun elements(): List { inline(true) deprecate(Strings) { forBinaryCompatibility } include(CharSequences, Strings) - doc { "Returns the last element matching the given [predicate], or `null` if no such element was found." } - doc(CharSequences) { "Returns the last character matching the given [predicate], or `null` if no such character was found." } + doc { f -> "Returns the last ${f.element} matching the given [predicate], or `null` if no such ${f.element} was found." } returns("T?") body { f -> (if (f == Iterables) @@ -702,15 +693,13 @@ fun elements(): List { inline(true) deprecate(Strings) { forBinaryCompatibility } include(Lists, CharSequences, Strings) - doc { "Returns the last element matching the given [predicate], or `null` if no such element was found." } - doc(CharSequences) { "Returns the last character matching the given [predicate], or `null` if no such character was found." } + doc { f -> "Returns the last ${f.element} matching the given [predicate], or `null` if no such ${f.element} was found." } returns("T?") body { "return lastOrNull(predicate)"} } templates add f("single()") { - doc { "Returns the single element, or throws an exception if the collection is empty or has more than one element." } - doc(CharSequences) { "Returns the single character, or throws an exception if the string is empty or has more than one character." } + doc { f -> "Returns the single ${f.element}, or throws an exception if the ${f.collection} is empty or has more than one ${f.element}." } returns("T") body { """ @@ -765,8 +754,7 @@ fun elements(): List { } templates add f("singleOrNull()") { - doc { "Returns single element, or `null` if the collection is empty or has more than one element." } - doc(CharSequences) { "Returns the single character, or `null` if the string is empty or has more than one character." } + doc { f -> "Returns single ${f.element}, or `null` if the ${f.collection} is empty or has more than one ${f.element}." } returns("T?") body { """ @@ -812,8 +800,7 @@ fun elements(): List { inline(true) deprecate(Strings) { forBinaryCompatibility } include(CharSequences, Strings) - doc { "Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element." } - doc(CharSequences) { "Returns the single character matching the given [predicate], or throws exception if there is no or more than one matching character." } + doc { f -> "Returns the single ${f.element} matching the given [predicate], or throws exception if there is no or more than one matching ${f.element}." } returns("T") body { """ @@ -836,8 +823,7 @@ fun elements(): List { inline(true) deprecate(Strings) { forBinaryCompatibility } include(CharSequences, Strings) - doc { "Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found." } - doc(CharSequences) { "Returns the single character matching the given [predicate], or `null` if character was not found or more than one character was found." } + doc { f -> "Returns the single ${f.element} matching the given [predicate], or `null` if ${f.element} was not found or more than one ${f.element} was found." } returns("T?") body { """ diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Generators.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Generators.kt index 1785925c1de..08ec47e6b3e 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Generators.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Generators.kt @@ -1,6 +1,7 @@ package templates import templates.Family.* +import templates.DocExtensions.collection fun generators(): List { val templates = arrayListOf() @@ -395,11 +396,11 @@ fun generators(): List { templates add f("partition(predicate: (T) -> Boolean)") { inline(true) - doc { + doc { f -> """ - Splits the original collection into pair of collections, - where *first* collection contains elements for which [predicate] yielded `true`, - while *second* collection contains elements for which [predicate] yielded `false`. + Splits the original ${f.collection} into pair of lists, + where *first* list contains elements for which [predicate] yielded `true`, + while *second* list contains elements for which [predicate] yielded `false`. """ } // TODO: Sequence variant @@ -422,7 +423,7 @@ fun generators(): List { deprecate(Strings) { forBinaryCompatibility } doc(CharSequences) { """ - Splits the original string into pair of strings, + Splits the original char sequence into pair of strings, where *first* string contains characters for which [predicate] yielded `true`, while *second* string contains characters for which [predicate] yielded `false`. """ @@ -560,7 +561,7 @@ fun generators(): List { only(CharSequences, Strings) doc { """ - Returns a list of values built from characters of both strings with same indexes using provided [transform]. List has length of shortest string. + Returns a list of values built from characters of both char sequences with same indexes using provided [transform]. List has length of shortest char sequence. """ } typeParam("V") @@ -601,7 +602,7 @@ fun generators(): List { only(CharSequences, Strings) doc { """ - Returns a list of pairs built from characters of both strings with same indexes. List has length of shortest collection. + Returns a list of pairs built from characters of both char sequences with same indexes. List has length of shortest char sequence. """ } returns("List>") @@ -648,7 +649,7 @@ fun generators(): List { doc { """ Returns a sequence of pairs built from elements of both collections with same indexes. - Resulting sequence has length of shortest input sequences. + Resulting sequence has length of shortest input sequence. """ } typeParam("R") diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Mapping.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Mapping.kt index d48a3f09e5a..5b2c5b8ba09 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Mapping.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Mapping.kt @@ -1,6 +1,9 @@ package templates import templates.Family.* +import templates.DocExtensions.element +import templates.DocExtensions.collection +import templates.DocExtensions.mapResult fun mapping(): List { val templates = arrayListOf() @@ -8,7 +11,7 @@ fun mapping(): List { templates add f("withIndex()") { deprecate(Strings) { forBinaryCompatibility } include(CharSequences, Strings) - doc { "Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection." } + doc { f -> "Returns a ${if (f == Sequences) f.mapResult else "lazy [Iterable]"} of [IndexedValue] for each ${f.element} of the original ${f.collection}." } returns("Iterable>") body { """ @@ -17,7 +20,6 @@ fun mapping(): List { } returns(Sequences) { "Sequence>" } - doc(Sequences) { "Returns a sequence of [IndexedValue] for each element of the original sequence." } body(Sequences) { """ return IndexingSequence(this) @@ -28,7 +30,7 @@ fun mapping(): List { templates add f("mapIndexed(transform: (Int, T) -> R)") { inline(true) - doc { "Returns a list containing the results of applying the given [transform] function to each element and its index of the original collection." } + doc { f -> "Returns a ${f.mapResult} containing the results of applying the given [transform] function to each ${f.element} and its index in the original ${f.collection}." } typeParam("R") returns("List") body { @@ -43,7 +45,6 @@ fun mapping(): List { } inline(false, Sequences) returns(Sequences) { "Sequence" } - doc(Sequences) { "Returns a sequence containing the results of applying the given [transform] function to each element and its index of the original sequence." } body(Sequences) { "return TransformingIndexedSequence(this, transform)" } @@ -52,7 +53,7 @@ fun mapping(): List { templates add f("map(transform: (T) -> R)") { inline(true) - doc { "Returns a list containing the results of applying the given [transform] function to each element of the original collection." } + doc { f -> "Returns a ${f.mapResult} containing the results of applying the given [transform] function to each ${f.element} of the original ${f.collection}." } typeParam("R") returns("List") body { @@ -68,7 +69,6 @@ fun mapping(): List { inline(false, Sequences) returns(Sequences) { "Sequence" } - doc(Sequences) { "Returns a sequence containing the results of applying the given [transform] function to each element of the original sequence." } body(Sequences) { "return TransformingSequence(this, transform)" } @@ -79,7 +79,7 @@ fun mapping(): List { templates add f("mapNotNull(transform: (T) -> R)") { inline(true) exclude(Strings, ArraysOfPrimitives) - doc { "Returns a list containing the results of applying the given [transform] function to each non-null element of the original collection." } + doc { f -> "Returns a ${f.mapResult} containing the results of applying the given [transform] function to each non-null ${f.element} of the original ${f.collection}." } deprecate(Deprecation("This function will change its semantics soon to map&filter rather than filter&map. Use filterNotNull().map {} instead.", replaceWith = "filterNotNull().map(transform)")) typeParam("T : Any") typeParam("R") @@ -91,7 +91,6 @@ fun mapping(): List { """ } - doc(Sequences) { "Returns a sequence containing the results of applying the given [transform] function to each non-null element of the original sequence." } returns(Sequences) { "Sequence" } inline(false, Sequences) body(Sequences) { @@ -105,9 +104,9 @@ fun mapping(): List { templates add f("mapTo(destination: C, transform: (T) -> R)") { inline(true) - doc { + doc { f -> """ - Appends transformed elements of the original collection using the given [transform] function + Appends transformed ${f.element}s of the original ${f.collection} using the given [transform] function to the given [destination]. """ } @@ -129,9 +128,9 @@ fun mapping(): List { templates add f("mapIndexedTo(destination: C, transform: (Int, T) -> R)") { inline(true) - doc { + doc { f -> """ - Appends transformed elements and their indices of the original collection using the given [transform] function + Appends transformed ${f.element}s and their indices in the original ${f.collection} using the given [transform] function to the given [destination]. """ } @@ -185,7 +184,7 @@ fun mapping(): List { inline(true) exclude(Sequences) - doc { "Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection." } + doc { f -> "Returns a single list of all elements yielded from results of [transform] function being invoked on each ${f.element} of original ${f.collection}." } typeParam("R") returns("List") body { @@ -208,7 +207,7 @@ fun mapping(): List { templates add f("flatMapTo(destination: C, transform: (T) -> Iterable)") { inline(true) exclude(Sequences) - doc { "Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination]." } + doc { f -> "Appends all elements yielded from results of [transform] function being invoked on each ${f.element} of original ${f.collection}, to the given [destination]." } typeParam("R") typeParam("C : MutableCollection") returns("C") @@ -249,7 +248,7 @@ fun mapping(): List { deprecate(Strings) { forBinaryCompatibility } include(CharSequences, Strings) - doc { "Returns a map of the elements in original collection grouped by the result of given [toKey] function." } + doc { f -> "Returns a map of the ${f.element}s in original ${f.collection} grouped by the result of given [toKey] function." } typeParam("K") returns("Map>") body { "return groupByTo(LinkedHashMap>(), toKey)" } @@ -261,7 +260,7 @@ fun mapping(): List { deprecate(Strings) { forBinaryCompatibility } include(CharSequences, Strings) typeParam("K") - doc { "Appends elements from original collection grouped by the result of given [toKey] function to the given [map]." } + doc { f -> "Appends ${f.element}s from original ${f.collection} grouped by the result of given [toKey] function to the given [map]." } returns("Map>") body { """ diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Numeric.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Numeric.kt index c91958e6eb4..e05a6a6e050 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Numeric.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Numeric.kt @@ -1,6 +1,7 @@ package templates import templates.Family.* +import templates.DocExtensions.collection fun numeric(): List { val templates = arrayListOf() @@ -8,7 +9,7 @@ fun numeric(): List { templates add f("sum()") { exclude(Strings) buildFamilies.forEach { family -> onlyPrimitives(family, numericPrimitives) } - doc { "Returns the sum of all elements in the collection." } + doc { f -> "Returns the sum of all elements in the ${f.collection}." } returns("SUM") platformName("sumOf") body { @@ -26,7 +27,7 @@ fun numeric(): List { templates add f("average()") { exclude(Strings) buildFamilies.forEach { family -> onlyPrimitives(family, numericPrimitives) } - doc { "Returns an average value of elements in the collection."} + doc { f -> "Returns an average value of elements in the ${f.collection}."} returns("Double") platformName("averageOf") body { diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Sets.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Sets.kt index 478331bf3a6..d2201bb71e5 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Sets.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Sets.kt @@ -1,13 +1,16 @@ package templates import templates.Family.* +import templates.DocExtensions.element +import templates.DocExtensions.collection +import templates.DocExtensions.mapResult fun sets(): List { val templates = arrayListOf() templates add f("toMutableSet()") { exclude(Strings) - doc { "Returns a mutable set containing all distinct elements from the given collection." } + doc { f -> "Returns a mutable set containing all distinct ${f.element}s from the given ${f.collection}." } returns("MutableSet") body { """ @@ -36,28 +39,29 @@ fun sets(): List { templates add f("distinct()") { exclude(Strings) - val collectionDoc = """ - Returns a list containing only distinct elements from the given collection. - - The elements in the resulting list are in the same order as they were in the source collection. + doc { f -> """ - doc { collectionDoc } + Returns a ${f.mapResult} containing only distinct ${f.element}s from the given ${f.collection}. + + The ${f.element}s in the resulting ${f.mapResult} are in the same order as they were in the source ${f.collection}. + """ + } returns("List") body { "return this.toMutableSet().toList()" } - doc(Sequences) { collectionDoc.replace("list", "sequence").replace("collection", "sequence") } returns(Sequences) { "Sequence" } body(Sequences) { "return this.distinctBy { it }" } } templates add f("distinctBy(keySelector: (T) -> K)") { exclude(Strings) - val collectionDoc = """ - Returns a list containing only distinct elements from the given collection according to the [keySelector]. - - The elements in the resulting list are in the same order as they were in the source collection. + doc { f -> """ - doc { collectionDoc } + Returns a ${f.mapResult} containing only distinct ${f.element}s from the given ${f.collection} according to the [keySelector]. + + The ${f.element}s in the resulting ${f.mapResult} are in the same order as they were in the source ${f.collection}. + """ + } inline(true) typeParam("K") @@ -76,7 +80,6 @@ fun sets(): List { } inline(false, Sequences) - doc(Sequences) { collectionDoc.replace("list", "sequence").replace("collection", "sequence") } returns(Sequences) { "Sequence" } body(Sequences) { """ diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Snapshots.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Snapshots.kt index f218dc10aac..493153eb17a 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Snapshots.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Snapshots.kt @@ -1,7 +1,8 @@ package templates import templates.Family.* -import java.util.ArrayList +import templates.DocExtensions.element +import templates.DocExtensions.collection fun snapshots(): List { val templates = arrayListOf() @@ -9,7 +10,7 @@ fun snapshots(): List { templates add f("toCollection(collection: C)") { deprecate(Strings) { forBinaryCompatibility } include(CharSequences, Strings) - doc { "Appends all elements to the given [collection]." } + doc { f -> "Appends all ${f.element}s to the given [collection]." } returns("C") typeParam("C : MutableCollection") body { @@ -23,7 +24,7 @@ fun snapshots(): List { } templates add f("toSet()") { - doc { "Returns a [Set] of all elements." } + doc { f -> "Returns a [Set] of all ${f.element}s." } returns("Set") body { "return toCollection(LinkedHashSet(mapCapacity(collectionSizeOrDefault(12))))" } body(Sequences) { "return toCollection(LinkedHashSet())" } @@ -33,7 +34,7 @@ fun snapshots(): List { } templates add f("toHashSet()") { - doc { "Returns a [HashSet] of all elements." } + doc { f -> "Returns a [HashSet] of all ${f.element}s." } returns("HashSet") body { "return toCollection(HashSet(mapCapacity(collectionSizeOrDefault(12))))" } body(Sequences) { "return toCollection(HashSet())" } @@ -45,13 +46,13 @@ fun snapshots(): List { templates add f("toSortedSet()") { deprecate(Strings) { forBinaryCompatibility } include(CharSequences, Strings) - doc { "Returns a [SortedSet] of all elements." } + doc { f -> "Returns a [SortedSet] of all ${f.element}s." } returns("SortedSet") body { "return toCollection(TreeSet())" } } templates add f("toArrayList()") { - doc { "Returns an [ArrayList] of all elements." } + doc { f -> "Returns an [ArrayList] of all ${f.element}s." } returns("ArrayList") body { "return toCollection(ArrayList())" } body(Iterables) { @@ -91,7 +92,7 @@ fun snapshots(): List { templates add f("toList()") { deprecate(Strings) { forBinaryCompatibility } include(CharSequences, Strings) - doc { "Returns a [List] containing all elements." } + doc { f -> "Returns a [List] containing all ${f.element}s." } returns("List") body { "return this.toArrayList()" } } @@ -116,10 +117,11 @@ fun snapshots(): List { templates add f("toMapBy(selector: (T) -> K)") { inline(true) typeParam("K") - doc { + doc { f -> """ - Returns Map containing the values from the given collection indexed by [selector]. - If any two elements would have the same key returned by [selector] the last one gets added to the map. + Returns Map containing the ${f.element}s from the given ${f.collection} indexed by the key + returned from [selector] function applied to each ${f.element}. + If any two ${f.element}s would have the same key returned by [selector] the last one gets added to the map. """ } returns("Map") @@ -175,10 +177,10 @@ fun snapshots(): List { inline(true) typeParam("K") typeParam("V") - doc { + doc { f -> """ - Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection. - If any two elements would have the same key returned by [selector] the last one gets added to the map. + Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to ${f.element}s of the given ${f.collection}. + If any two ${f.element}s would have the same key returned by [selector] the last one gets added to the map. """ } returns("Map")