title: guava: Best way to iterate over the key->collection entries of a Multimap?
body: <p>I'm looking for the corresponding way, for <a href="http://guava-libraries.googlecode.com/svn/tags/release03/javadoc/com/google/common/collect/Multimap.html" rel="noreferrer"><code>Multimap</code></a>, to iterate over entries of a <a href="http://download.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true" rel="noreferrer"><code>Map</code></a>, namely:</p>
  
  <pre><code>Map&lt;K,V&gt; map = ...;
  for (Map.Entry&lt;K,V&gt; entry : map.entrySet())
  {
      K k = entry.getKey();
      V v = entry.getValue();
  }
  </code></pre>
  
  <p>Which of the following is better? (or perhaps more importantly, what are the differences?)</p>
  
  <pre><code>Multimap&lt;K,V&gt; mmap = ...;
  for (Map.Entry&lt;K,Collection&lt;V&gt;&gt; entry : mmap.asMap().entrySet())
  {
      K k = entry.getKey();
      Collection&lt;V&gt; v = entry.getValue();
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Multimap&lt;K,V&gt; mmap = ...;
  for (K k : mmap.keySet())
  {
      Collection&lt;V&gt; v = mmap.get(k);
  }
  </code></pre>