## CSDN博客

### ListIterator接口分析

ListIterator是List迭代器，该接口继承Iterator，有关Iterator接口请看：
http://blog.csdn.net/treeroot/archive/2004/09/11/101589.aspx

public interface ListIterator extends Iterator

1.boolean hasNext()

2. boolean next()

3.boolean hasPrevious()

4.Object previous()

5.int nextIndex()

6.int previousIndex()

7.void remove()

previous()返回的元素，其他都一样

8.void set(Object o)

/**
*
* An iterator for lists that allows the programmer
* to traverse the list in either direction, modify
* the list during iteration, and obtain the iterator's
* current position in the list. A ListIterator
* has no current element; its cursor position always
* lies between the element that would be returned by a call
* to previous() and the element that would be
* returned by a call to next(). In a list of
* length n, there are n+1 valid
* index values, from 0 to n, inclusive.
*

**                     Element(0) Element(1) Element(2) ... Element(n) *                 ^             ^          ^           ^             ^* Index:          0             1          2           3             n+1** * * Note that the {@link #remove} and {@link #set(Object)} methods are* not defined in terms of the cursor position; they are defined to* operate on the last element returned by a call to {@link #next} or {@link* #previous()}.*/

0 0