ListIterator

Traverse through ArrayList in reverse direction using Java ListIterator Example

Want to learn quickly?
Try one of the many quizzes. More than Java 400 questions with detailed answers.

Add Comment

  • Hi,

    If we need to traverse in reverse direction then line no 29 and 30 are overhead.

    Instead use following (only reverse direction traversal)

    ListIterator listIterator = list.listIterator(list.size());

    while(listIterator.hasPrevious())
    System.out.println(listIterator.previous());

    output is as per expectation !!!

Sponsors

Facebook Fans

Online Shopping – Flipkart