Skip to content

Commit d5211ec

Browse files
author
Yalun Qin
committed
Add usage of reverse iteration to TestListIterator.java
1 parent de2aa4a commit d5211ec

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

TestListIterator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public static void main(String[] args) {
1616
}
1717

1818
System.out.println("\nTraversing the list in backward direction:");
19+
//If without previous iteration, we should create iter like this:
20+
//iter = l1.listIterator(l1.size()), so that iter points to the position
21+
//right after the last element.
1922
while (iter.hasPrevious()){
2023
System.out.println(iter.previousIndex() + ": " + iter.previous());
2124
}

0 commit comments

Comments
 (0)