public class Demo5 {
public static void main(String[] args) {
// TODO Auto-generated method stub
List list=new ArrayList();
list.add("ZG");
list.add("RR");
list.add("pp");
System.out.println(list.size());
// System.out.println(list.toString());
ListIterator lit=list.listIterator();//声明迭代器
while(lit.hasNext()) {
System.out.println(lit.nextIndex()+":"+lit.next());
}
while(lit.hasPrevious()) {//反向遍历
System.out.println(lit.previousIndex()+":"+lit.previous());
}
boolean iff=list.contains("Z");
System.out.println(iff);
}
// TODO Auto-generated method stub
List list=new ArrayList();
list.add("ZG");
list.add("RR");
list.add("pp");
System.out.println(list.size());
// System.out.println(list.toString());
ListIterator lit=list.listIterator();//声明迭代器
while(lit.hasNext()) {
System.out.println(lit.nextIndex()+":"+lit.next());
}
while(lit.hasPrevious()) {//反向遍历
System.out.println(lit.previousIndex()+":"+lit.previous());
}
boolean iff=list.contains("Z");
System.out.println(iff);
}
}