title: Cannot find symbol with getOrDefault function of Map
body: <p>I have created a Hashamp of Integer type</p>
  <pre><code>HashMap&lt;Integer, Integer&gt; map = new HashMap&lt;&gt;();
  </code></pre>
  <p>The key for the map is an array of type Integer and I'm trying to count the occurrence of each key using the put and getOrDefault function.</p>
  <p>Below is the code snippet for the same -</p>
  <pre><code>   static int migratoryBirds(List&lt;Integer&gt; arr) {
          int count = 0;
          HashMap&lt;Integer, Integer&gt; map = new HashMap&lt;&gt;();
          System.out.println(map.toString());
           for(Integer bird : arr)
            {
                 System.out.println(map.getOrDefault(bird,0));
                map.put(bird,map.getOrDefault(bird,0)+1);
            }
  </code></pre>
  <p>I'm getting the below error while using the getOrDefault function-</p>
  <pre><code>error: cannot find symbol
                 System.out.println(map.getOrDefault(bird,0));
                                       ^
    symbol:   method getOrDefault(Integer,int)
    location: variable map of type HashMap&lt;Integer,Integer&gt;
  </code></pre>
  <p>How can I resolve the error?</p>