import java.util.ArrayList;import java.util.List;import java.util.ListIterator;public class TestDemo { public static void main(String[] args) { List list = new ArrayList (); list.add(1); list.add(5); list.add(2); list.add(4); list.add(3); System.out.println("----------for循环-----------"); int size = list.size(); for(int i=0;i it = list.iterator(); while(it.hasNext()){ System.out.print(it.next() + " "); } System.out.println(); System.out.println("--------双向迭代器---------"); ListIterator lte = list.listIterator(); while(lte.hasNext()){ System.out.print(lte.next() + " "); } System.out.println(); while(lte.hasPrevious()){ System.out.print(lte.previous()+" "); } }}