Here is my solution:
val patronGold: MutableMap<String, Double> = uniquePatrons.map {
it to 10.0
}.toMap() as MutableMap<String, Double>
What do you think, guys? Are there any easier or more concise ways of solving it?
Here is my solution:
val patronGold: MutableMap<String, Double> = uniquePatrons.map {
it to 10.0
}.toMap() as MutableMap<String, Double>
What do you think, guys? Are there any easier or more concise ways of solving it?
edit: never mind, I just learned about distinct() from another thread
What was your solution to part 1 of the challenge? I can’t seem to make it work in true functional style…
Another way:
val patronGold = uniquePatrons.associateWith { 6.0 }