📅  最后修改于: 2022-03-11 14:52:16.489000             🧑  作者: Mango
List names = new ArrayList<>(List.of("John Doe", "Jack Doe", "John Smith"));
List johns = new ArrayList<>();
for (String name: names) {
if (name.startsWith("John")) {
johns.add(name);
}
}
names.removeAll(johns);