title: Java: What does this for-loop do?
body: <pre><code>for (String key : output.keySet())
  {
         // some code
  }
  </code></pre>
  
  <p>Output is an object of hashmap and I want to iterate through the hashmap for all values. I find an example on the internet that write such for loop... But when I try to execute this, Eclipse does not allow me to do so. Please tell me an efficient way or explain this loop. So that I can iterate through the map.</p>
  
  <p>Pseudo of my function is somewhat like this</p>
  
  <pre><code>public void function (String key)
  {
       Set&lt;String&gt; keys = output.keySet();
  
      // now I have to iterate through the keySet and match 'key' with the keys from keySet 
  }
  </code></pre>