title: Java HashMap iteration Map.Entry<> vs Entry<>
body: <p>I am new to Java and writing java on a Mac using HashMap. <br/>
  However I encountered a problem that I can't find the answer</p>
  
  <pre><code>import java.util.Map;
  import java.util.HashMap;
  
  public class Test {
      public static void main(String[] args) {
          Map&lt;String, Integer&gt; hm = new HashMap&lt;&gt;();
          hm.put("a", 1);
          hm.put("b", 2);
          for (Entry&lt;String, Integer&gt; en : hm.entrySet()) {  //this line is different
              System.out.print(en.getKey());
              System.out.println(en.getValue());
          }
      }
  }
  </code></pre>
  
  <p>This code works fine on a windows machine, but on my Mac it pops out an error indicating that "can not find symbol: Entry "</p>
  
  <p>Later I changed code to </p>
  
  <pre><code>import java.util.Map;
  import java.util.HashMap;
  
  public class Test {
      public static void main(String[] args) {
          Map&lt;String, Integer&gt; hm = new HashMap&lt;&gt;();
          hm.put("a", 1);
          hm.put("b", 2);
          for (Map.Entry&lt;String, Integer&gt; en : hm.entrySet()) {  //this line is different
              System.out.print(en.getKey());
              System.out.println(en.getValue());
          }
      }
  }
  </code></pre>
  
  <p>And now it works fine.</p>
  
  <p>Can anybody tell me why? <br/>
  Why this code works fine on others computer but not on mine?</p>