DEV Community

loizenai
loizenai

Posted on

Kotlin – average() function with Kotlin Array & List examples

https://grokonez.com/kotlin/kotlin-average-function-kotlin-array-list-examples

Kotlin – average() function with Kotlin Array & List examples

In the tutorial, JavaSampleApproach will show you how to use Kotlin average() function with Kotlin Array & List collections by examples.

I. Kotlin List with average() function

With Kotlin List, We use following method signatures of average():


fun Iterable.average(): Double (source)
fun Iterable.average(): Double (source)
fun Iterable.average(): Double (source)
fun Iterable.average(): Double (source)
fun Iterable.average(): Double (source)
fun Iterable.average(): Double (source)

-> Returns an average value of elements in the collection.

Practice:

More at:

https://grokonez.com/kotlin/kotlin-average-function-kotlin-array-list-examples

Top comments (0)