Skip to content

Commit 074f0bb

Browse files
committed
BarEntry more idiomatic and concise Kotlin style
1 parent b8bccba commit 074f0bb

File tree

1 file changed

+1
-8
lines changed
  • chartLib/src/main/kotlin/info/appdev/charting/data

1 file changed

+1
-8
lines changed

chartLib/src/main/kotlin/info/appdev/charting/data/BarEntry.kt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,7 @@ open class BarEntry : Entry {
225225
* Calculates the sum across all values of the given stack.
226226
*/
227227
private fun calcSum(vals: FloatArray?): Float {
228-
if (vals == null)
229-
return 0f
230-
231-
var sum = 0f
232-
233-
for (f in vals) sum += f
234-
235-
return sum
228+
return vals?.sum() ?: 0f
236229
}
237230
}
238231
}

0 commit comments

Comments
 (0)