July 2018
Intermediate to advanced
400 pages
12h 14m
English
Using the functional techniques you learned in this chapter, write a function called flipValues that allows you to flip-flop the keys and values in a map. For example:
val gradesByStudent = mapOf("Josh" to 4.0, "Alex" to 2.0, "Jane" to 3.0)
{Josh=4.0, Alex=2.0, Jane=3.0}
flipValues(gradesByStudent)
{4.0=Josh, 2.0=Alex, 3.0=Jane}
Read now
Unlock full access