katas
katas copied to clipboard
ZipKata answer is wrong
Zip kata does not provides the right solution: https://github.com/FunctionalKotlin/katas/tree/master/src/main/java/functional/transforms/zip
It has the MapReduce solution. The correct answer is:
fun getFirstActorMap(movies: List<Movie>, casts: List<Cast>): Map<String, String?> =
movies.zip(casts)
.map { (movie, cast) ->
movie.title to cast.people.first().name.substringBefore(" ")
}.toMap()