title: How to reverse a Map in Kotlin?
body: <p>I am trying to reverse a Map in Kotlin. So far, I have come up with:</p>
  
  <pre><code>mapOf("foo" to 42)
    .toList()
    .map { (k, v) -&gt; v to k }
    .toMap()
  </code></pre>
  
  <p>Is there any better way of doing this without using a middleman(middlelist)?</p>