by Dinesh Thakur

 

import java.util.*;

class JavaExampleListIterator
 {
     public static void main(String aa[])
      {
         LinkedList LnkdLst = new LinkedList();
         LnkdLst.add("Item Zero");
         LnkdLst.add("Item One");
         LnkdLst.add("Item Two");
         LnkdLst.add("Item Three");
         LnkdLst.add("Item Four");
         LnkdLst.add("Item Five");
         LnkdLst.add("Item Six");
         ListIterator LstItrtr = LnkdLst.listIterator();
         while(LstItrtr.hasNext())
            {
                LstItrtr.set("That is "+ LstItrtr.next());
            }
                while(LstItrtr.hasPrevious())
                   {
                        System.out.println(LstItrtr.previous());
                   }
       }
 }
ListIterator Java Example