下面代码清空的时候报错,为什么?
Iterator<String> iter = dev_model.keys();
while (iter.hasNext()){
String key = iter.next();// 获得key
dev_model.remove(key);
}
下面代码清空的时候报错,为什么?
Iterator<String> iter = dev_model.keys();
while (iter.hasNext()){
String key = iter.next();// 获得key
dev_model.remove(key);
}
代码修改如下:
Iterator<String> iter = dev_model.keys();
while (iter.hasNext()){
String key = iter.next();// 获得key
iter.remove();
dev_model.remove(key);
}