What are the benefits of the Iterator interface in Java?

后端 未结 16 1951
没有蜡笔的小新
没有蜡笔的小新 2020-12-04 14:35

I just learned about how the Java Collections Framework implements data structures in linked lists. From what I understand, Iterators are a way of traversing th

16条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-04 15:17

    Ultimately, because Iterator captures a control abstraction that is applicable to a large number of data structures. If you're up on your category theory fu, you can have your mind blown by this paper: The Essence of the Iterator Pattern.

提交回复
热议问题