title: "Destructuring" a Map.Entry in a Scala closure
body: <pre><code>val m: java.util.Map[String, Int] = ...
  m.foreach { entry =&gt;
    val (key, value) = entry
    // do stuff with key and value
  }
  </code></pre>
  
  <p>Is there a better way to destructure the Map.Entry? I tried the following, but it does not compile:</p>
  
  <pre><code>m.foreach { (key, value) =&gt;
    // do stuff with key and value
  }
  </code></pre>