public class ListIteratorEx {
public static void main(String args[]) {
List<String> li = new ArrayList<String>();
li.add("java1");
li.add("java2");
li.add("java3");
li.add("java4");
ListIterator itr = li.listIterator();
while(itr.hasNext()) {
System.out.println(itr.next());
}
System.out.println(itr.nextIndex());
System.out.println(itr.previousIndex());
}
}