What are the benefits of the Iterator interface in Java?

后端 未结 16 1945
没有蜡笔的小新
没有蜡笔的小新 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:00

    Just M2C, if you weren't aware: you can avoid directly using the iterator interface in situations where the for-each loop will suffice.

提交回复
热议问题