I need to get a total size of a 2d list. This is my implementation:
fun totalSize(parts: List<List<String>>): Int {
return parts.reduce { total, next -> total + next.size }
}
I get type inference fail. Required Int, Got List. But next.size should return Int.
` - i.e. T (input type) must be a subtype of S (the returned type).– charles-allen Aug 15 '17 at 05:57