Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Aggregate functions
// count
println(languagesList.count())
//maxBy
println(languagesList.maxBy { it.name.length })
//minBy
println(languagesList.minBy { it.name.length })
//average
println(arrayOf(8, 8, 10, 9, 9).average())
//sum
println(arrayOf(7.3, 7.6, 7.4, 7.6, 8.1, 7.7).sum())
println(languagesList.sumBy { it.releaseYear })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment