Heim  >  Fragen und Antworten  >  Hauptteil

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

ringa_leeringa_lee2719 Tage vor833

Antworte allen(1)Ich werde antworten

  • PHP中文网

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

    先声明:

    • Map没实现Collection接口

    • Collection表示这是一个集合,即定义了集合的接口

    • Iterator则是遍历集合的接口

    回答:

    为了降低耦合。Iterator也是要作为组件去复用的,而不仅仅是Collection接口中使用了它。

    Antwort
    0
  • StornierenAntwort