Source (java.util.listiterator<e>)--

Source: Internet
Author: User

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>)--

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.