Collection<E>

来源:互联网 发布:淘宝男休闲运动皮鞋 编辑:程序博客网 时间:2024/06/13 17:13

Collection的由来

  1. 在讲List之前,先简要介绍一下Collection

    Collection继承了一个叫做Iterable的接口,里面包含属性Iterator

    Iterable接口结构

    而Iterator接口中定义了3个方法:hasNext(),next(),remove()

    Iterator接口结构

    其中remove方法没有返回值,作用为将迭代器新返回的元素删除
    官方注释为:Removes from the underlying collection the last element returned by this iterator

原创粉丝点击