An alternative to providing a ListIterator is to provide a method with signature Iterator reverseIterator( ) that

Question:

An alternative to providing a ListIterator is to provide a method with signature
Iterator reverseIterator( )
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
Iterator<AnyType> ritr = L.reverseIterator( ); while( ritr.hasNext( ) ) System.out.printin( ritr.next( ) );
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  book-img-for-question
Question Posted: