Java.util.listiterator<e> Source Analysis (JDK1.7)
---------------------------------------------------------------------------------
java.util.listiterator<e> is an interface that is defined as follows :
1 Package Java.util; 2 3 4 Public Interface extends Iterator<e> { 5 // Operations 6 }
(1) java.util.listiterator<e> list collection iterator that allows you to traverse the list collection in either direction, modify the list collection elements during an iteration, and get the current position of the iterator in the list
---------------------------------------------------------------------------------
Let's look at the specific methods in the Java.util.listiterator<e> interface:
| void Add (E e) |
Inserts the specified element into the list |
| Boolean Hasnext () |
Returns true if the list iterator has more than one element when traversing the list in a forward direction |
| Boolean hasprevious () |
Returns true if the list iterator has multiple elements that iterate through the collection of lists |
| E Next () |
Returns the next element in the list |
| int Nextindex () |
Returns the index of the element returned by subsequent calls to next |
| E Previous () |
Returns the previous element in a list collection |
| int Previousindex () |
Returns the index of the element returned by subsequent calls to previous |
| void Remove () |
Removes the last element returned by next or previous from the list |
| void Set (E e) |
Replaces the last element returned by next or previous with the specified element |
---------------------------------------------------------------------------------
The Java.util.listiterator<e> interface source code is as follows:
1 Public InterfaceListiterator<e>extendsIterator<e> {2 //Query Operations3 BooleanHasnext ();4 5 E Next ();6 7 Booleanhasprevious ();8 9 E Previous ();Ten One intNextindex (); A - intPreviousindex (); - the //modification Operations - voidremove (); - - voidset (e e); + - voidAdd (e e); +}
Source (java.util.listiterator<e>)--