Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
777 changes: 777 additions & 0 deletions libraries/stdlib/common/src/generated/_Arrays.kt

Large diffs are not rendered by default.

143 changes: 143 additions & 0 deletions libraries/stdlib/common/src/generated/_Collections.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2813,6 +2813,77 @@ public inline fun <T, C : Iterable<T>> C.onEachIndexed(action: (index: Int, T) -
return apply { forEachIndexed(action) }
}

/**
* Returns the product of all values produced by [selector] function applied to each element in the collection.
*/
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("productOfDouble")
@kotlin.internal.InlineOnly
public inline fun <T> Iterable<T>.productOf(selector: (T) -> Double): Double {
var product: Double = 1.toDouble()
for (element in this) {
product *= selector(element)
}
return product
}

/**
* Returns the product of all values produced by [selector] function applied to each element in the collection.
*/
@kotlin.jvm.JvmName("productOfInt")
@kotlin.internal.InlineOnly
public inline fun <T> Iterable<T>.productOf(selector: (T) -> Int): Int {
var product: Int = 1.toInt()
for (element in this) {
product *= selector(element)
}
return product
}

/**
* Returns the product of all values produced by [selector] function applied to each element in the collection.
*/
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("productOfLong")
@kotlin.internal.InlineOnly
public inline fun <T> Iterable<T>.productOf(selector: (T) -> Long): Long {
var product: Long = 1.toLong()
for (element in this) {
product *= selector(element)
}
return product
}

/**
* Returns the product of all values produced by [selector] function applied to each element in the collection.
*/
@kotlin.jvm.JvmName("productOfUInt")
@kotlin.internal.InlineOnly
public inline fun <T> Iterable<T>.productOf(selector: (T) -> UInt): UInt {
var product: UInt = 1.toUInt()
for (element in this) {
product *= selector(element)
}
return product
}

/**
* Returns the product of all values produced by [selector] function applied to each element in the collection.
*/
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("productOfULong")
@kotlin.internal.InlineOnly
public inline fun <T> Iterable<T>.productOf(selector: (T) -> ULong): ULong {
var product: ULong = 1.toULong()
for (element in this) {
product *= selector(element)
}
return product
}

/**
* Accumulates value starting with the first element and applying [operation] from left to right
* to current accumulator value and each element.
Expand Down Expand Up @@ -3768,6 +3839,78 @@ public fun Iterable<Double>.average(): Double {
return if (count == 0) Double.NaN else sum / count
}

/**
* Returns the product of all elements in the collection.
*/
@kotlin.jvm.JvmName("productOfByte")
public fun Iterable<Byte>.product(): Int {
var product: Int = 1
for (element in this) {
product *= element
}
return product
}

/**
* Returns the product of all elements in the collection.
*/
@kotlin.jvm.JvmName("productOfShort")
public fun Iterable<Short>.product(): Int {
var product: Int = 1
for (element in this) {
product *= element
}
return product
}

/**
* Returns the product of all elements in the collection.
*/
@kotlin.jvm.JvmName("productOfInt")
public fun Iterable<Int>.product(): Int {
var product: Int = 1
for (element in this) {
product *= element
}
return product
}

/**
* Returns the product of all elements in the collection.
*/
@kotlin.jvm.JvmName("productOfLong")
public fun Iterable<Long>.product(): Long {
var product: Long = 1L
for (element in this) {
product *= element
}
return product
}

/**
* Returns the product of all elements in the collection.
*/
@kotlin.jvm.JvmName("productOfFloat")
public fun Iterable<Float>.product(): Float {
var product: Float = 1.0f
for (element in this) {
product *= element
}
return product
}

/**
* Returns the product of all elements in the collection.
*/
@kotlin.jvm.JvmName("productOfDouble")
public fun Iterable<Double>.product(): Double {
var product: Double = 1.0
for (element in this) {
product *= element
}
return product
}

/**
* Returns the sum of all elements in the collection.
*/
Expand Down
165 changes: 165 additions & 0 deletions libraries/stdlib/common/src/generated/_Sequences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2325,6 +2325,87 @@ public fun <T> Sequence<T>.onEachIndexed(action: (index: Int, T) -> Unit): Seque
}
}

/**
* Returns the product of all values produced by [selector] function applied to each element in the sequence.
*
* The operation is _terminal_.
*/
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("productOfDouble")
@kotlin.internal.InlineOnly
public inline fun <T> Sequence<T>.productOf(selector: (T) -> Double): Double {
var product: Double = 1.toDouble()
for (element in this) {
product *= selector(element)
}
return product
}

/**
* Returns the product of all values produced by [selector] function applied to each element in the sequence.
*
* The operation is _terminal_.
*/
@kotlin.jvm.JvmName("productOfInt")
@kotlin.internal.InlineOnly
public inline fun <T> Sequence<T>.productOf(selector: (T) -> Int): Int {
var product: Int = 1.toInt()
for (element in this) {
product *= selector(element)
}
return product
}

/**
* Returns the product of all values produced by [selector] function applied to each element in the sequence.
*
* The operation is _terminal_.
*/
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("productOfLong")
@kotlin.internal.InlineOnly
public inline fun <T> Sequence<T>.productOf(selector: (T) -> Long): Long {
var product: Long = 1.toLong()
for (element in this) {
product *= selector(element)
}
return product
}

/**
* Returns the product of all values produced by [selector] function applied to each element in the sequence.
*
* The operation is _terminal_.
*/
@kotlin.jvm.JvmName("productOfUInt")
@kotlin.internal.InlineOnly
public inline fun <T> Sequence<T>.productOf(selector: (T) -> UInt): UInt {
var product: UInt = 1.toUInt()
for (element in this) {
product *= selector(element)
}
return product
}

/**
* Returns the product of all values produced by [selector] function applied to each element in the sequence.
*
* The operation is _terminal_.
*/
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("productOfULong")
@kotlin.internal.InlineOnly
public inline fun <T> Sequence<T>.productOf(selector: (T) -> ULong): ULong {
var product: ULong = 1.toULong()
for (element in this) {
product *= selector(element)
}
return product
}

/**
* Accumulates value starting with the first element and applying [operation] from left to right
* to current accumulator value and each element.
Expand Down Expand Up @@ -3155,6 +3236,90 @@ public fun Sequence<Double>.average(): Double {
return if (count == 0) Double.NaN else sum / count
}

/**
* Returns the product of all elements in the sequence.
*
* The operation is _terminal_.
*/
@kotlin.jvm.JvmName("productOfByte")
public fun Sequence<Byte>.product(): Int {
var product: Int = 1
for (element in this) {
product *= element
}
return product
}

/**
* Returns the product of all elements in the sequence.
*
* The operation is _terminal_.
*/
@kotlin.jvm.JvmName("productOfShort")
public fun Sequence<Short>.product(): Int {
var product: Int = 1
for (element in this) {
product *= element
}
return product
}

/**
* Returns the product of all elements in the sequence.
*
* The operation is _terminal_.
*/
@kotlin.jvm.JvmName("productOfInt")
public fun Sequence<Int>.product(): Int {
var product: Int = 1
for (element in this) {
product *= element
}
return product
}

/**
* Returns the product of all elements in the sequence.
*
* The operation is _terminal_.
*/
@kotlin.jvm.JvmName("productOfLong")
public fun Sequence<Long>.product(): Long {
var product: Long = 1L
for (element in this) {
product *= element
}
return product
}

/**
* Returns the product of all elements in the sequence.
*
* The operation is _terminal_.
*/
@kotlin.jvm.JvmName("productOfFloat")
public fun Sequence<Float>.product(): Float {
var product: Float = 1.0f
for (element in this) {
product *= element
}
return product
}

/**
* Returns the product of all elements in the sequence.
*
* The operation is _terminal_.
*/
@kotlin.jvm.JvmName("productOfDouble")
public fun Sequence<Double>.product(): Double {
var product: Double = 1.0
for (element in this) {
product *= element
}
return product
}

/**
* Returns the sum of all elements in the sequence.
*
Expand Down
Loading