>>>>>>>>>>>>>>正确方法:
Iterator<Entry<String, ArrayList<String>>> blockIterator = blockMap.entrySet().iterator(); while(blockIterator.hasNext()){ Entry<String, ArrayList<String>> entry= blockIterator.next(); String key_date = entry.getKey(); if(key_date.compareTo(sformat.format(date))<=0){ blockIterator.remove(); } }
>>>>>>>>>>>这个方法是错误的!!!!!!!! for(String key_date : blockMap.keySet()){ if(key_date.compareTo(sformat.format(date))<=0){ blockMap.remove(key_date);,//不能再迭代的时候删除!!!; } }