An alternative to providing a ListIterator is to provide a method with signature Iterator reverseIterator( ) that
Question:
Iterator
that returns an Iterator, initialized to the last item, and for which next and hasNext are implemented to be consistent with the iterator advancing toward the front of the list, rather than the back. Then you could print a MyArrayList L in reverse by using the code
Implement an ArrayListReverseIterator class, with this logic, and have reverseIterator return a newly constructed ArrayListReverseIterator.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss
Question Posted: