LinkedList: iterator() : LinkedList « java.util « Java by API






LinkedList: iterator()

 

import java.util.Iterator;
import java.util.LinkedList;

public class Main {
  public static void main(String[] args) {
    LinkedList<String> lList = new LinkedList<String>();
    lList.add("1");
    lList.add("2");
    lList.add("3");
    lList.add("4");
    lList.add("5");

    Iterator itr = lList.iterator();
    while (itr.hasNext()) {
      System.out.println(itr.next());
    }
  }
}

   
  








Related examples in the same category

1.new LinkedList < E > ()
2.LinkedList: add(E o)
3.LinkedList: add(int index, E element)
4.LinkedList: addFirst(E o)
5.LinkedList: addLast(E o)
6.LinkedList: clear()
7.LinkedList: get(int index)
8.LinkedList: getFirst()
9.LinkedList: getLast()
10.LinkedList: indexOf(Object o)
11.LinkedList: lastIndexOf(Object o)
12.LinkedList: remove(int index)
13.LinkedList: remove(Object o)
14.LinkedList: removeFirst()
15.LinkedList: removeLast()
16.LinkedList: set(int index, E element)
17.LinkedList: subList(int fromIndex, int toIndex)
18.LinkedList: toArray(T[] a)