Kotlin HashSet sumBy()
Syntax & Examples


Syntax of HashSet.sumBy()

The syntax of HashSet.sumBy() extension function is:

fun <T> Iterable<T>.sumBy(selector: (T) -> Int): Int

This sumBy() extension function of HashSet returns the sum of all values produced by selector function applied to each element in the collection.