package com.wf.bean;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
public class Demo {
/**
* @param <E>
* @param args
*/
public static void main(String[] args) {
List c = new ArrayList();
c.add("hello");
c.add("world");
c.add("java");
ListIterator it = c.listIterator();
while (it.hasNext()) {
String s = (String) it.next();
if ("world".equals(s)) {
it.add("javaee");
}
}
System.out.println(c);
}
}
|
|