@@ -0,0 +1,934 @@
+import java.util.HashMap;%0Aimport java.util.Iterator;%0Aimport java.util.Map;%0A%0A/**%0A * Created by mazhuang on 2016/9/13.%0A */%0Apublic class CollectionsOperate %7B%0A    public static void main(String%5B%5D args) %7B%0A        deleteFromMap();%0A    %7D%0A%0A    public static void deleteFromMap() %7B%0A        Map%3CInteger, String%3E map = new HashMap%3C%3E();%0A        map.put(0, %22Zero%22);%0A        map.put(1, %22One%22);%0A        map.put(2, %22Two%22);%0A%0A        // ok, but not in traversal%0A        map.remove(1);%0A%0A        for (Map.Entry%3CInteger, String%3E entry : map.entrySet()) %7B%0A            // error! java.util.ConcurrentModificationException%0A            // map.remove(entry.getKey());%0A        %7D%0A%0A        Iterator%3CMap.Entry%3CInteger, String%3E%3E iterator = map.entrySet().iterator();%0A        while (iterator.hasNext()) %7B%0A            // the only right way to remove element from collections when traversal%0A            iterator.next();%0A            iterator.remove();%0A        %7D%0A    %7D%0A%7D%0A

Add right way to remove element from collections when traversal