BIG阳
iterator只能向前迭代List还额外提供了一个listIterator()方法,该方法返回一个ListIterator对象,ListIterator接口继承了Iterator接口,ListIterator比Iterator增加了向后迭代的功能不过在使用ListIterator迭代时,开始也需要正向迭代,然后在倒序迭代public class Test {public static void main(String[] args) {String[] books = {"English book","Chinese book"};List bookList = new ArrayList();for(int i = 0;i<books.length;i++) {bookList.add(books[i]);}ListIterator lit = bookList.listIterator();while(lit.hasNext()) {System.out.println(lit.next());}System.ou.println(" 下面开始反向迭代");while (lit.hasPrecious()) {System.out.println(lit.previous());}}}