title: Remove method in HashMap java does not work
body: <p>I have removed the map with the method <code>"remove(key)"</code> but just the value was deleted. When I call the <code>keySet()</code> method. The key still there!!.
  The below program, I want to find two groups (2 map in the HashMap) have shortest distance. Then merge them, that mean I need to remove these two groups and put the merged group to maps.</p>
  
  <pre><code>/* I have already initiate the HashMap groups*/
  ArrayList&lt;String&gt; listGroupNames ;
  while (currentNumberOfGroup &gt; 1000){
    System.out.println("Groups" + currentNumberOfGroup);
    listGroupNames  =  new ArrayList&lt;String&gt;(groups.keySet());
    /*  Name of two groups will be merged*/
    String candidate1 = "";
    String candidate2 = "";
    double maxSimilarity = 0;
  
    /* finding two groups which have shortest distance*/
    for(String event1 : listGroupNames){
      for(String event2 : listGroupNames){
        if(!event1.equalsIgnoreCase(event2)){
            Group group1 = groups.get(event1);
            Group otherGrp = groups.get(event2);
            double similarity = group1.getMaxSimilarityWith(otherGrp, simpledEvent);
            if(similarity &gt; maxSimilarity){
              maxSimilarity = similarity;
              candidate1 = event1;
              candidate2 = event2;
            }
        }
      }
    }
    /*  2 groups have shortest distance were found already*/
    /* Merge 2 groups then replace these two groups by merged group*/
    Group groupCandidate1 = groups.get(candidate1) ;
    Group groupCandidate2 = groups.get(candidate2) ;
    Group mergerdGroup = groupCandidate1.mergeToOtherGroup(groupCandidate2);
    /*remove 2 found groups*/
    groups.remove(candidate2);
    groups.remove(candidate1);
  
    groups.put(mergerdGroup.name, mergerdGroup);
    listGroupNames.clear();
    currentNumberOfGroup --;      
  }
  </code></pre>