W3cubDocs

/Kotlin

sumOf

Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)
@JvmName("sumOfDouble") inline fun <T> Sequence<T>.sumOf(
    selector: (T) -> Double
): Double
Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)
@JvmName("sumOfInt") inline fun <T> Sequence<T>.sumOf(
    selector: (T) -> Int
): Int
Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)
@JvmName("sumOfLong") inline fun <T> Sequence<T>.sumOf(
    selector: (T) -> Long
): Long
Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)
@JvmName("sumOfUInt") @ExperimentalUnsignedTypes inline fun <T> Sequence<T>.sumOf(
    selector: (T) -> UInt
): UInt
Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)
@JvmName("sumOfULong") @ExperimentalUnsignedTypes inline fun <T> Sequence<T>.sumOf(
    selector: (T) -> ULong
): ULong
Platform and version requirements: JVM (1.4)
@JvmName("sumOfBigDecimal") inline fun <T> Sequence<T>.sumOf(
    selector: (T) -> BigDecimal
): BigDecimal
Platform and version requirements: JVM (1.4)
@JvmName("sumOfBigInteger") inline fun <T> Sequence<T>.sumOf(
    selector: (T) -> BigInteger
): BigInteger

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

The operation is terminal.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.sequences/sum-of.html