class Demo {
public static void main (String[] args) {
List list = new ArrayList();
list.add("JavaSE");
list.add("JavaWeb");
list.add("JavaEE");
list.add("JavaEE");
for (Iterator it = list.iterator(); it.hasNext(); ) {
String str = (String)it.next();
if ("JavaWeb".equals( str )) {
list.add("Android");
}
}
System.out.println( list );
}
} |
|