javaList接口
作者:互联网
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);
} }
标签:javaList,list,System,接口,lit,add,println,out 来源: https://www.cnblogs.com/tilyougogannbare666/p/12970703.html