- import java.util.ArrayList;
- import java.util.Iterator;
- public class Itcast {
- public static void main(String[] args) {
- ArrayList<String> list = new ArrayList<String>();
- // list.add("张三");
- list.add("李四");
- Iterator<String> it = list.iterator();
- while (it.hasNext()) {
- System.out.println(it.next());
- list.remove("张三");
- }
- }
- }
复制代码 |