一,集合

  1. 概念:对象的容器
  2. 核心:对数据结构和算法的OOP体现
  3. 接口层:

(1)Collection

  1. List:有序不唯一    值可以为null

ArrayList     数组结构

LinkedList    链表结构

  1. Set:无序且唯一    值最多只有一个null

(2)Map

  1. 键唯一           最多只有一个null
  2. 值不唯一         值可以为null
  3. jdk<=1.7    数组+链表
  4. jdk>=1.8    数组+链表+红黑树

        新增Entry  >=2   >=8

        删除Entry  <=1  <=6

(3)Serializable:序列化接口

(4)Iterable<T>:迭代接口  =依赖=>Iterator<T>

Class Xxx implement Iterable<T>{

    Iterator<T>iterator(){

  .....

   }

}

Xxx<T>xxx = new Xxx(...)

//迭代器遍历模型

Iterator<T>it = new Xxx(...).iterator();

While(it.hasNext()){

  T t = it.next();

.....

}

增强型for循环遍历:底层是迭代器

for(T t : xxx){

  t...

}

 

posted on 2020-06-29 08:09  尧啊尧  阅读(101)  评论(0编辑  收藏  举报