If you have a collection in some object oriented language (e.g., Java) you might be interested in traversing it. By traversing I mean visiting each and every one of the members in the collection in some specific order (e.g., front to back, back to front). Many collections already come with an Iterator. Some do not. In particular you may develop an object and wish to traverse it from first to last. In that case you could develop an Iterator.
If you wish to learn more about collections and iterators, I would recommend using a reference book (e.g., Algorithms fourth edition by Robert Sedgewick and Kevin Wayne) or perform a search on the Internet. Continue reading “Iterator – Java”