// map中key(鍵)的迭代器對象
Iterator<String> iterator = myMap.keySet().iterator();
while (iterator.hasNext()){// 循環取鍵值進行判斷
String key = iterator.next();// 鍵
if(key.startsWith("week")){
iterator.remove();// 移除map中以week字符開頭的鍵對應的鍵值對
}
if(key.startsWith("lessonNo")){
iterator.remove();// 移除map中以lessonNo字符開頭的鍵對應的鍵值對
}
}
來源:https://blog.csdn.net/qq_37584445/article/details/88681622