📅  最后修改于: 2022-03-11 14:52:14.638000             🧑  作者: Mango
List names = new ArrayList<>(List.of("John Doe", "Jack Doe", "John Smith"));
Iterator it = names.iterator();
while (it.hasNext()) {
String name = it.next();
if (name.startsWith("John")) {
it.remove();
}
}