W3cubDocs

/Kotlin

sum

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
@JvmName("sumOfByte") fun Array<out Byte>.sum(): Int
@JvmName("sumOfShort") fun Array<out Short>.sum(): Int
@JvmName("sumOfInt") fun Array<out Int>.sum(): Int
@JvmName("sumOfLong") fun Array<out Long>.sum(): Long
@JvmName("sumOfFloat") fun Array<out Float>.sum(): Float
@JvmName("sumOfDouble") fun Array<out Double>.sum(): Double
fun ByteArray.sum(): Int
fun ShortArray.sum(): Int
fun IntArray.sum(): Int
fun LongArray.sum(): Long
fun FloatArray.sum(): Float
fun DoubleArray.sum(): Double
@JvmName("sumOfUInt") @ExperimentalUnsignedTypes fun Array<out UInt>.sum(): UInt
@JvmName("sumOfULong") @ExperimentalUnsignedTypes fun Array<out ULong>.sum(): ULong
@JvmName("sumOfUByte") @ExperimentalUnsignedTypes fun Array<out UByte>.sum(): UInt
@JvmName("sumOfUShort") @ExperimentalUnsignedTypes fun Array<out UShort>.sum(): UInt
@ExperimentalUnsignedTypes fun UIntArray.sum(): UInt
@ExperimentalUnsignedTypes fun ULongArray.sum(): ULong
@ExperimentalUnsignedTypes fun UByteArray.sum(): UInt
@ExperimentalUnsignedTypes fun UShortArray.sum(): UInt

Returns the sum of all elements in the array.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
@JvmName("sumOfByte") fun Iterable<Byte>.sum(): Int
@JvmName("sumOfShort") fun Iterable<Short>.sum(): Int
@JvmName("sumOfInt") fun Iterable<Int>.sum(): Int
@JvmName("sumOfLong") fun Iterable<Long>.sum(): Long
@JvmName("sumOfFloat") fun Iterable<Float>.sum(): Float
@JvmName("sumOfDouble") fun Iterable<Double>.sum(): Double
@JvmName("sumOfUInt") @ExperimentalUnsignedTypes fun Iterable<UInt>.sum(): UInt
@JvmName("sumOfULong") @ExperimentalUnsignedTypes fun Iterable<ULong>.sum(): ULong
@JvmName("sumOfUByte") @ExperimentalUnsignedTypes fun Iterable<UByte>.sum(): UInt
@JvmName("sumOfUShort") @ExperimentalUnsignedTypes fun Iterable<UShort>.sum(): UInt

Returns the sum of all elements in the collection.

© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/sum.html