Extension function with type Any
I was trying to write a more generic extension function which counts elements of all lists in a map:
So, instead of
val Map.listElementCount: Int
get() {
var total = 0
for (list in this.values) { total += list.size}
return total
}
I would like to write as I then could apply it to all Maps with a List of values
val Map.listElementCount: Int
get() {
var total = 0
for (list in this.values) { total += list.size}
return total
}
This...