Introduce sumOf with various selector types
#KT-11253
This commit is contained in:
@@ -2702,3 +2702,291 @@ public fun <T> Array<out T>.toSortedSet(comparator: Comparator<in T>): java.util
|
||||
return toCollection(java.util.TreeSet<T>(comparator))
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun <T> Array<out T>.sumOf(selector: (T) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ByteArray.sumOf(selector: (Byte) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ShortArray.sumOf(selector: (Short) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun IntArray.sumOf(selector: (Int) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun LongArray.sumOf(selector: (Long) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun FloatArray.sumOf(selector: (Float) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun DoubleArray.sumOf(selector: (Double) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun BooleanArray.sumOf(selector: (Boolean) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun CharArray.sumOf(selector: (Char) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun <T> Array<out T>.sumOf(selector: (T) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ByteArray.sumOf(selector: (Byte) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ShortArray.sumOf(selector: (Short) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun IntArray.sumOf(selector: (Int) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun LongArray.sumOf(selector: (Long) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun FloatArray.sumOf(selector: (Float) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun DoubleArray.sumOf(selector: (Double) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun BooleanArray.sumOf(selector: (Boolean) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun CharArray.sumOf(selector: (Char) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
|
||||
@@ -55,3 +55,35 @@ public fun <T> Iterable<T>.toSortedSet(comparator: Comparator<in T>): java.util.
|
||||
return toCollection(java.util.TreeSet<T>(comparator))
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the collection.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun <T> Iterable<T>.sumOf(selector: (T) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the collection.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun <T> Iterable<T>.sumOf(selector: (T) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
|
||||
@@ -55,3 +55,39 @@ public fun <T> Sequence<T>.toSortedSet(comparator: Comparator<in T>): java.util.
|
||||
return toCollection(java.util.TreeSet<T>(comparator))
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the sequence.
|
||||
*
|
||||
* The operation is _terminal_.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun <T> Sequence<T>.sumOf(selector: (T) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the sequence.
|
||||
*
|
||||
* The operation is _terminal_.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun <T> Sequence<T>.sumOf(selector: (T) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
|
||||
@@ -31,3 +31,35 @@ public fun CharSequence.toSortedSet(): java.util.SortedSet<Char> {
|
||||
return toCollection(java.util.TreeSet<Char>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each character in the char sequence.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun CharSequence.sumOf(selector: (Char) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each character in the char sequence.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun CharSequence.sumOf(selector: (Char) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
|
||||
@@ -285,3 +285,139 @@ public fun UShortArray.binarySearch(element: UShort, fromIndex: Int = 0, toIndex
|
||||
return -(low + 1) // key not found
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UIntArray.sumOf(selector: (UInt) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ULongArray.sumOf(selector: (ULong) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UByteArray.sumOf(selector: (UByte) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigDecimal")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UShortArray.sumOf(selector: (UShort) -> java.math.BigDecimal): java.math.BigDecimal {
|
||||
var sum: java.math.BigDecimal = 0.toBigDecimal()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UIntArray.sumOf(selector: (UInt) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ULongArray.sumOf(selector: (ULong) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UByteArray.sumOf(selector: (UByte) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@kotlin.jvm.JvmName("sumOfBigInteger")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UShortArray.sumOf(selector: (UShort) -> java.math.BigInteger): java.math.BigInteger {
|
||||
var sum: java.math.BigInteger = 0.toBigInteger()
|
||||
for (element in this) {
|
||||
sum += selector(element)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user