import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
public class MainClass {
public static void main(String[] a) {
List list = new LinkedList();
list.add("A");
list.add("B");
list.add("C");
list.add("D");
ListIterator iter = list.listIterator(list.size());
while (iter.hasPrevious()) {
System.out.println(iter.previous());
}
}
}
D
C
B
A
While Iterator only supports remove(), ListIterator adds set() and add() methods.
Using the nextIndex() and previousIndex() methods allows you to find out the index of the
elements around the current cursor position:
public int nextIndex()
public int previousIndex()