Most of the times the simplest way to traverse a list in Java is to use an Iterator.
If your List is a LinkedList, then you can also use a descendingIterator.
For more list-specific methods, there is ListIterator, that can move forward and backward among other things.
No comments:
Post a Comment