Home  >  Q&A  >  body text

collection - 为什么Java集合框架要用内部类迭代器的设计来实现读取操作?

ringa_leeringa_lee2719 days ago832

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 10:45:42

    First statement:

    • Map does not implement the Collection interface

    • Collection means that this is a collection, that is, the interface of the collection is defined

    • Iterator is the interface for traversing collections

    Answer:

    To reduce coupling. Iterator also needs to be reused as a component, not just used in the Collection interface.

    reply
    0
  • Cancelreply