import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;
import java.util.Iterator;
public class TestCode {
public static void main(String[] args) {
ArrayList list=new ArrayList();
list.add("nihao");
list.add("wohao");
list.add("dajiahao");
list.add("nihao");
list.add(1, "tahao");
ListIterator it=list.listIterator();
System.out.println("原始List中的元素是:");
while(it.hasNext()){
System.out.println(it.next()+"");
}
for(Iterator iter1=list.iterator();iter1.hasNext();){
String s=(String)iter1.next();
if(s.equals("nihao")){
it.set("nibuhao");
}
}
while(it.hasPrevious())
{
String s = it.previous().toString();
System.out.println("\t"+s);
}
}
}