sumBy

Common
JVM
JS
Native
1.0
@DeprecatedSinceKotlin("1.5") inline fun <T> Array<out T>.sumBy(
    selector: (T) -> Int
): Int
Deprecated: Use sumOf instead.
@DeprecatedSinceKotlin("1.5") inline fun ByteArray.sumBy(
    selector: (Byte) -> Int
): Int
Deprecated: Use sumOf instead.
@DeprecatedSinceKotlin("1.5") inline fun ShortArray.sumBy(
    selector: (Short) -> Int
): Int
Deprecated: Use sumOf instead.
@DeprecatedSinceKotlin("1.5") inline fun IntArray.sumBy(
    selector: (Int) -> Int
): Int
Deprecated: Use sumOf instead.
@DeprecatedSinceKotlin("1.5") inline fun LongArray.sumBy(
    selector: (Long) -> Int
): Int
Deprecated: Use sumOf instead.
@DeprecatedSinceKotlin("1.5") inline fun FloatArray.sumBy(
    selector: (Float) -> Int
): Int
Deprecated: Use sumOf instead.
@DeprecatedSinceKotlin("1.5") inline fun DoubleArray.sumBy(
    selector: (Double) -> Int
): Int
Deprecated: Use sumOf instead.
@DeprecatedSinceKotlin("1.5") inline fun BooleanArray.sumBy(
    selector: (Boolean) -> Int
): Int
Deprecated: Use sumOf instead.
@DeprecatedSinceKotlin("1.5") inline fun CharArray.sumBy(
    selector: (Char) -> Int
): Int
Deprecated: Use sumOf instead.
@DeprecatedSinceKotlin("1.5") @ExperimentalUnsignedTypes inline fun UIntArray.sumBy(
    selector: (UInt) -> UInt
): UInt
Deprecated: Use sumOf instead.
@DeprecatedSinceKotlin("1.5") @ExperimentalUnsignedTypes inline fun ULongArray.sumBy(
    selector: (ULong) -> UInt
): UInt
Deprecated: Use sumOf instead.
@DeprecatedSinceKotlin("1.5") @ExperimentalUnsignedTypes inline fun UByteArray.sumBy(
    selector: (UByte) -> UInt
): UInt
Deprecated: Use sumOf instead.
@DeprecatedSinceKotlin("1.5") @ExperimentalUnsignedTypes inline fun UShortArray.sumBy(
    selector: (UShort) -> UInt
): UInt
Deprecated: Use sumOf instead.

Returns the sum of all values produced by selector function applied to each element in the array.

Common
JVM
JS
Native
1.0
@DeprecatedSinceKotlin("1.5") inline fun <T> Iterable<T>.sumBy(
    selector: (T) -> Int
): Int
Deprecated: Use sumOf instead.

Returns the sum of all values produced by selector function applied to each element in the collection.