Skip to content

Commit 144d20b

Browse files
committed
fix: deprecated function replaced
1 parent e8a7e1c commit 144d20b

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

Collections/Sum/src/Task.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Return the sum of prices for all the products ordered by a given customer
22
fun moneySpentBy(customer: Customer): Double =
3-
customer.orders.flatMap { it.products }.sumByDouble { it.price }
3+
customer.orders.flatMap { it.products }.sumOf { it.price }

Collections/Sum/task-info.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ files:
44
visible: true
55
placeholders:
66
- offset: 132
7-
length: 64
7+
length: 58
88
placeholder_text: TODO()
99
- name: src/Shop.kt
1010
visible: true

Collections/Sum/task.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ the sum of the prices for all the products ordered by a given customer.
55
Note that each product should be counted as many times as it was ordered.
66

77
Use
8-
[`sum`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/sum.html) or
9-
[`sumOf`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/sum-of.html).
10-
If you want to sum up double values, use `sumOfDouble`.
8+
[`sum`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/sum.html) or
9+
[`sumOf`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/sum-of.html), if you want to sum up double values.
1110

1211
```kotlin
1312
listOf(1, 5, 3).sum() == 9

0 commit comments

Comments
 (0)