title: How I can get ConcurrentModificationException while iterating Hashmap?
body: <p>I am trying to add a key value pair to the hashmap inside the Iterator method.</p>
  
  <p>But this is not giving me <code>ConcurrentModificationException</code> . Why?</p>
  
  <p>Since Hashmap is failfast.</p>
  
  <pre><code>Map&lt;String,String&gt; m = new HashMap&lt;&gt;();
             m.put("a", "a");
  
             Iterator&lt;String&gt; i = m.keySet().iterator();
             while(i.hasNext()){
                 System.out.println(i.next());
                 m.put("dsad", "asfsdf");
  
             }
  </code></pre>
  
  <p>If this is wrong, How i can produce ConcurrentModificationException  ?
  Thanks.</p>
  
  <p>Update: Just checked.</p>
  
  <pre><code>Map&lt;String,String&gt; m = new HashMap&lt;&gt;();
                 m.put("a", "a");
            m.put("abc", "a");
  
                 Iterator&lt;String&gt; i = m.keySet().iterator();
                 while(i.hasNext()){
                     System.out.println(i.next());
                     m.put("dsad", "asfsdf");
  
                 }
  </code></pre>
  
  <p>This is giving me the exception.</p>