title: Iterator for ConcurrentHashMap giving strange result
body: <p>ConcurrentHashMap is thread safe. So if am adding any values to map at the time of iterating, it should not consider them. Below is my code: </p>
  
  <pre><code>public class Test {
  public static void main(String[] args) {
      ConcurrentHashMap&lt;String, Integer&gt; map = new ConcurrentHashMap&lt;String, Integer&gt;();
      map.put("ONE", 1);
      map.put("TWO", 2);
      Iterator&lt;String&gt; it = map.keySet().iterator();
      while (it.hasNext()) {
          String key = (String) it.next();
          System.out.println(key + " : " + map.get(key));
          map.put("9", 10); // This should not be reflected in the Iterator
          map.put("5", 10); // This should not be reflected in the Iterator
      }
  }
  }
  </code></pre>
  
  <h2>Output:</h2>
  
  <pre><code>    TWO : 2
      ONE : 1
      9 : 10
  </code></pre>
  
  <p>My question is why iterator considering map.put("9", 10);</p>