package Devmanuals.com; import java.util.LinkedList; import java.util.ListIterator; public class ListIteratorPreviousIndex { public static void main(String args[]) { LinkedList llist = new LinkedList(); llist.add("A"); llist.add("B"); llist.add("C"); llist.add("D"); llist.add("E"); System.out.println("List = " + llist); ListIterator litr = llist.listIterator(); while (litr.hasNext()) litr.next(); while (litr.hasPrevious()) System.out.println(litr.previous() + " is at position " + litr.previousIndex()); System.out .println("Index of A is shown -1 because the cursor is positioned now at beginning of list"); } }