List<String> list = new ArrayList<>(Arrays.asList("a1", "ab2", "a3", "ab4", "a5", "ab6", "a9", "ab8", "a9"));
/**
* 删除含有b的元素
*/
for (Iterator<String> ite = list.iterator(); ite.hasNext();) {
String str = ite.next();
if (str.contains("b")) {
ite.remove();
}
}
for(String s:list)
System.out.println(s);
/**
* 删除a9元素
*/
List<String> delList=new ArrayList<String>();
delList.add("a9");
list.removeAll(delList);
for(String s:list)
System.out.println(s);