Close sidebar

What is the difference between cursors ...

What is the difference between cursors like ListIterator, Iterator and enumeration.

Your Answer

In numerous texts, I've seen the term cursor used interchangeably with the term iterator. However, it doesn't seem right that they are treated as the same thing. To me, an iterator allows iteration of a container with no knowledge of the container itself. A cursor, on the other hand, allows iteration of a container as well but has implementation details specific to the container type, so it does keep a reference to the container. Additionally a cursor's interface mirrors the interface of the container kind of like the facade pattern.

Comments

Didn't get the answer.
Contact people of Talent-Core Java directly by clicking here