使用迭代器进行删除:
List<String> list = new ArrayList<String>(Arrays.asList("a1", "a2", "a3", "b1", "b2", "b3"));
for (Iterator<String> iter = list.iterator(); iter.hasNext();) {
String str = iter.next();
if (str.contains("b")) {
iter.remove();
}
}
后续还会更新。