太麻烦了,不如这样
public class Test04 {
public static void main(String[] args) {
ArrayList<String> aList = new ArrayList<String>();
aList.add("abc");
aList.add("abcd");
aList.add("gfd");
aList.add("abc");
aList.add("igdg");
aList.add("abc");
aList.add("bvgf");
aList.add("ytr");
System.out.println(aList);
while (aList.contains("abc")) {
aList.remove("abc");
}
System.out.println(aList);
}
}
|