1而柑、刪除list的正確方式
```swift
public class ArrayListRemove {
? ??List list = new ArrayList<>();
????list.add("北京");
????list.add("上海");
????list.add("廣州");
????list.add("深圳");
????list.add("廈門");
????list.add("南京");
????removeList(list, "上海");
}
public static void removeList(List list, String target){
? ??Iterator iter = list.iterator();
????String item = "";
? ?? while(iter.hasNext()){
????????item = iter.next();
? ?????? if(item.equals(target)){
? ?????????? iter.remove();
????????}
????}
print(list);
}
private static void print(List list){
????for(String item : list){
????????System.out.println("元素值:" + item);
????????}
????}
}
```
```
list
```