Return | Method | Summary |
---|---|---|
Iterator<E> | iterator() | Returns an iterator over the elements in this list in proper sequence. |
ListIterator<E> | listIterator() | Returns a list iterator over the elements in this list (in proper sequence). |
ListIterator<E> | listIterator(int index) | Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list. |
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public class Main {
public static void main(String[] args) {
List list = Collections.nCopies(5, "java2s.com");
System.out.println("List contains, ");
Iterator itr = list.iterator();
while (itr.hasNext()) {
System.out.println(itr.next());
}
}
}
The output:
List contains,
java2s.com
java2s.com
java2s.com
java2s.com
java2s.com
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |