Dan~

Just a few questions.

Dan Sugalski wrote:

2) They have 'next', 'previous', 'first', 'last', and 'reset' methods to get the next, previous, first, or last element in the iterator, or to reset the iterator to the beginning. Next, last, and reset change the internal current element pointer, first and last don't.

Do you mean next, previous, reset?


What about those data structures that can only be iterated in one direction easily (such as a singly linked list)? Should they implement previous in the slow and painful way and hope no one calls it? Should they throw an exception? Might it be worthwhile to have two different types of iterators (those that only go one direction and those that go both)?


Matt




Reply via email to