title: "Incompatible types" when accessing Map#entrySet()
body: <p>I am working on a simple config file reader for fun, but I am getting an odd error while writing the test method. In it is a <code>for</code> loop, and I have made sure that it causes the problem. It gives me this compilation error:</p>
  
  <pre><code>Incompatible types:
      Required: java.util.Map.Entry
      Found: java.lang.Object
  </code></pre>
  
  <p>The Map declaration is this:</p>
  
  <pre><code>Map&lt;String, String&gt; props = new HashMap&lt;String, String&gt;();
  </code></pre>
  
  <p>The <code>for</code> loop is written as below:</p>
  
  <pre><code>for (Map.Entry&lt;String, String&gt; entry : props.entrySet()) {
      //Body
  }
  </code></pre>
  
  <p>An SSCCE without imports which demonstrates the problem (At least in IntelliJ):</p>
  
  <pre><code>public class A {
      public static void main(String[] args) {
          Map&lt;String, String&gt; props = new HashMap&lt;String, String&gt;();
          for (int i = 0; i &lt; 100; i++) {
              props.put(new BigInteger(130, random).toString(32), new BigInteger(130, random).toString(32));
          }
          for (Map.Entry&lt;String, String&gt; entry : props.entrySet()) {
              System.out.println(entry.getKey() + ":" + entry.getValue());
          }
      }
  }
  </code></pre>
  
  <p><code>map</code> is a <code>Map&lt;String, String&gt;</code>, so that can't be the problem. I have googled alternative methods of doing this, but the main one people use seems to be this one! Yet for some reason it still fails. Any help would be appreciated. If you offer an alternative solution, please make sure it is fast - these config files could potentially be huge.</p>