title: How to delete another item(not the one you are holding) while Iterating the HashMap
body: <p>I've tried to search over the internet to find a solution of deleting another item but not the one you are visiting. Unfortunately, there is not a way to do it.</p>
  
  <p>Here is the problem.</p>
  
  <p>Assume I have a hashmap  and
  the items are &lt;0,10>  &lt;1,20> &lt;2,30> </p>
  
  <pre><code>    Map&lt;Integer,Integer&gt; map = new HashMap&lt;Integer, Integer&gt;() ;
      Iterator&lt;Map.Entry&lt;Integer, Integer&gt; &gt;entries = map.entrySet().iterator();
  
      while (entries.hasNext()) {
          Entry&lt;Integer, Integer&gt; entry = entries.next();
          int temp = entry.getValue();
          if (temp==0){
              map.remove(2);  //2 is the key of 3th item
          }
      }
  </code></pre>
  
  <p>Then the problem occours. 
  Really appreciate the suggestions.</p>