Deprecate sumBy and sumByDouble with WARNING
This commit is contained in:
@@ -21153,6 +21153,8 @@ public inline fun <R> CharArray.scanIndexed(initial: R, operation: (index: Int,
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun <T> Array<out T>.sumBy(selector: (T) -> Int): Int {
|
||||
var sum: Int = 0
|
||||
for (element in this) {
|
||||
@@ -21164,6 +21166,8 @@ public inline fun <T> Array<out T>.sumBy(selector: (T) -> Int): Int {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun ByteArray.sumBy(selector: (Byte) -> Int): Int {
|
||||
var sum: Int = 0
|
||||
for (element in this) {
|
||||
@@ -21175,6 +21179,8 @@ public inline fun ByteArray.sumBy(selector: (Byte) -> Int): Int {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun ShortArray.sumBy(selector: (Short) -> Int): Int {
|
||||
var sum: Int = 0
|
||||
for (element in this) {
|
||||
@@ -21186,6 +21192,8 @@ public inline fun ShortArray.sumBy(selector: (Short) -> Int): Int {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun IntArray.sumBy(selector: (Int) -> Int): Int {
|
||||
var sum: Int = 0
|
||||
for (element in this) {
|
||||
@@ -21197,6 +21205,8 @@ public inline fun IntArray.sumBy(selector: (Int) -> Int): Int {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun LongArray.sumBy(selector: (Long) -> Int): Int {
|
||||
var sum: Int = 0
|
||||
for (element in this) {
|
||||
@@ -21208,6 +21218,8 @@ public inline fun LongArray.sumBy(selector: (Long) -> Int): Int {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun FloatArray.sumBy(selector: (Float) -> Int): Int {
|
||||
var sum: Int = 0
|
||||
for (element in this) {
|
||||
@@ -21219,6 +21231,8 @@ public inline fun FloatArray.sumBy(selector: (Float) -> Int): Int {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun DoubleArray.sumBy(selector: (Double) -> Int): Int {
|
||||
var sum: Int = 0
|
||||
for (element in this) {
|
||||
@@ -21230,6 +21244,8 @@ public inline fun DoubleArray.sumBy(selector: (Double) -> Int): Int {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun BooleanArray.sumBy(selector: (Boolean) -> Int): Int {
|
||||
var sum: Int = 0
|
||||
for (element in this) {
|
||||
@@ -21241,6 +21257,8 @@ public inline fun BooleanArray.sumBy(selector: (Boolean) -> Int): Int {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun CharArray.sumBy(selector: (Char) -> Int): Int {
|
||||
var sum: Int = 0
|
||||
for (element in this) {
|
||||
@@ -21252,6 +21270,8 @@ public inline fun CharArray.sumBy(selector: (Char) -> Int): Int {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun <T> Array<out T>.sumByDouble(selector: (T) -> Double): Double {
|
||||
var sum: Double = 0.0
|
||||
for (element in this) {
|
||||
@@ -21263,6 +21283,8 @@ public inline fun <T> Array<out T>.sumByDouble(selector: (T) -> Double): Double
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun ByteArray.sumByDouble(selector: (Byte) -> Double): Double {
|
||||
var sum: Double = 0.0
|
||||
for (element in this) {
|
||||
@@ -21274,6 +21296,8 @@ public inline fun ByteArray.sumByDouble(selector: (Byte) -> Double): Double {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun ShortArray.sumByDouble(selector: (Short) -> Double): Double {
|
||||
var sum: Double = 0.0
|
||||
for (element in this) {
|
||||
@@ -21285,6 +21309,8 @@ public inline fun ShortArray.sumByDouble(selector: (Short) -> Double): Double {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun IntArray.sumByDouble(selector: (Int) -> Double): Double {
|
||||
var sum: Double = 0.0
|
||||
for (element in this) {
|
||||
@@ -21296,6 +21322,8 @@ public inline fun IntArray.sumByDouble(selector: (Int) -> Double): Double {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun LongArray.sumByDouble(selector: (Long) -> Double): Double {
|
||||
var sum: Double = 0.0
|
||||
for (element in this) {
|
||||
@@ -21307,6 +21335,8 @@ public inline fun LongArray.sumByDouble(selector: (Long) -> Double): Double {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun FloatArray.sumByDouble(selector: (Float) -> Double): Double {
|
||||
var sum: Double = 0.0
|
||||
for (element in this) {
|
||||
@@ -21318,6 +21348,8 @@ public inline fun FloatArray.sumByDouble(selector: (Float) -> Double): Double {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun DoubleArray.sumByDouble(selector: (Double) -> Double): Double {
|
||||
var sum: Double = 0.0
|
||||
for (element in this) {
|
||||
@@ -21329,6 +21361,8 @@ public inline fun DoubleArray.sumByDouble(selector: (Double) -> Double): Double
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun BooleanArray.sumByDouble(selector: (Boolean) -> Double): Double {
|
||||
var sum: Double = 0.0
|
||||
for (element in this) {
|
||||
@@ -21340,6 +21374,8 @@ public inline fun BooleanArray.sumByDouble(selector: (Boolean) -> Double): Doubl
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun CharArray.sumByDouble(selector: (Char) -> Double): Double {
|
||||
var sum: Double = 0.0
|
||||
for (element in this) {
|
||||
|
||||
@@ -2814,6 +2814,8 @@ public inline fun <T, R> Iterable<T>.scanIndexed(initial: R, operation: (index:
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the collection.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun <T> Iterable<T>.sumBy(selector: (T) -> Int): Int {
|
||||
var sum: Int = 0
|
||||
for (element in this) {
|
||||
@@ -2825,6 +2827,8 @@ public inline fun <T> Iterable<T>.sumBy(selector: (T) -> Int): Int {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the collection.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun <T> Iterable<T>.sumByDouble(selector: (T) -> Double): Double {
|
||||
var sum: Double = 0.0
|
||||
for (element in this) {
|
||||
|
||||
@@ -2257,6 +2257,8 @@ public fun <T, R> Sequence<T>.scanIndexed(initial: R, operation: (index: Int, ac
|
||||
*
|
||||
* The operation is _terminal_.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun <T> Sequence<T>.sumBy(selector: (T) -> Int): Int {
|
||||
var sum: Int = 0
|
||||
for (element in this) {
|
||||
@@ -2270,6 +2272,8 @@ public inline fun <T> Sequence<T>.sumBy(selector: (T) -> Int): Int {
|
||||
*
|
||||
* The operation is _terminal_.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun <T> Sequence<T>.sumByDouble(selector: (T) -> Double): Double {
|
||||
var sum: Double = 0.0
|
||||
for (element in this) {
|
||||
|
||||
@@ -2003,6 +2003,8 @@ public inline fun <R> CharSequence.scanIndexed(initial: R, operation: (index: In
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each character in the char sequence.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun CharSequence.sumBy(selector: (Char) -> Int): Int {
|
||||
var sum: Int = 0
|
||||
for (element in this) {
|
||||
@@ -2014,6 +2016,8 @@ public inline fun CharSequence.sumBy(selector: (Char) -> Int): Int {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each character in the char sequence.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public inline fun CharSequence.sumByDouble(selector: (Char) -> Double): Double {
|
||||
var sum: Double = 0.0
|
||||
for (element in this) {
|
||||
|
||||
@@ -9549,6 +9549,8 @@ public inline fun <R> UShortArray.scanIndexed(initial: R, operation: (index: Int
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
@@ -9563,6 +9565,8 @@ public inline fun UIntArray.sumBy(selector: (UInt) -> UInt): UInt {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
@@ -9577,6 +9581,8 @@ public inline fun ULongArray.sumBy(selector: (ULong) -> UInt): UInt {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
@@ -9591,6 +9597,8 @@ public inline fun UByteArray.sumBy(selector: (UByte) -> UInt): UInt {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
@@ -9605,6 +9613,8 @@ public inline fun UShortArray.sumBy(selector: (UShort) -> UInt): UInt {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
@@ -9619,6 +9629,8 @@ public inline fun UIntArray.sumByDouble(selector: (UInt) -> Double): Double {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
@@ -9633,6 +9645,8 @@ public inline fun ULongArray.sumByDouble(selector: (ULong) -> Double): Double {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
@@ -9647,6 +9661,8 @@ public inline fun UByteArray.sumByDouble(selector: (UByte) -> Double): Double {
|
||||
/**
|
||||
* Returns the sum of all values produced by [selector] function applied to each element in the array.
|
||||
*/
|
||||
@Deprecated("Use sumOf instead.", ReplaceWith("this.sumOf(selector)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
@@ -10489,7 +10505,7 @@ public inline fun ULongArray.sum(): ULong {
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UByteArray.sum(): UInt {
|
||||
return sumBy { it.toUInt() }
|
||||
return sumOf { it.toUInt() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -10499,6 +10515,6 @@ public inline fun UByteArray.sum(): UInt {
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UShortArray.sum(): UInt {
|
||||
return sumBy { it.toUInt() }
|
||||
return sumOf { it.toUInt() }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user