声明:本栏目所使用的素材都是凯哥学堂VIP学员所写,学员有权匿名,对文章有最终解释权;凯哥学堂旨在促进VIP学员互相学习的基础上公开笔记。 Vector:1.在多线程的情况下速度比较慢 2.线程安全类 2是最早的集合类. LinkedList:![image](http://os78f4hny.bkt.clouddn.com/201708250001.jpg?imageMogr2/blur/1x0/quality/75%7Cwatermark/1/image/aHR0cDovL29zNzhmNGhueS5ia3QuY2xvdWRkbi5jb20vd2F0ZXJtYXJrLnBuZw==/dissolve/50/gravity/SouthEast/dx/10/dy/10%7Cimageslim)
这个类就好比是双链集合 addFirst 是向前面添加 addLast 是向后面添加 removeLast 是向后面移除 removeFirst 是向前面移除 Stack 堆栈集合:此集合继承于vector 也是线程安全的 ![image](http://os78f4hny.bkt.clouddn.com/201708250002.jpg?imageMogr2/blur/1x0/quality/75%7Cwatermark/1/image/aHR0cDovL29zNzhmNGhueS5ia3QuY2xvdWRkbi5jb20vd2F0ZXJtYXJrLnBuZw==/dissolve/50/gravity/SouthEast/dx/10/dy/10%7Cimageslim)
push 压栈 就是一个添加 ![image](http://os78f4hny.bkt.clouddn.com/201708250003.jpg?imageMogr2/blur/1x0/quality/75%7Cwatermark/1/image/aHR0cDovL29zNzhmNGhueS5ia3QuY2xvdWRkbi5jb20vd2F0ZXJtYXJrLnBuZw==/dissolve/50/gravity/SouthEast/dx/10/dy/10%7Cimageslim)
pop 出栈peek 反馈当前要出栈的对象 1.先拿出当前要出栈对象 2.按下标输出要出栈的对象 3.返回拿出的对象 泛型:什么是泛型?泛型的目的是用来说明集合中存储的类型 一个类申请了泛型,如果你不使用的话,那就是一个object类型 ![image](http://os78f4hny.bkt.clouddn.com/201708250004.jpg?imageMogr2/blur/1x0/quality/75%7Cwatermark/1/image/aHR0cDovL29zNzhmNGhueS5ia3QuY2xvdWRkbi5jb20vd2F0ZXJtYXJrLnBuZw==/dissolve/50/gravity/SouthEast/dx/10/dy/10%7Cimageslim)
这个类里面有申请了泛型你才可以写泛型,没有就需要写 ![image](http://os78f4hny.bkt.clouddn.com/201708250005.jpg?imageMogr2/blur/1x0/quality/75%7Cwatermark/1/image/aHR0cDovL29zNzhmNGhueS5ia3QuY2xvdWRkbi5jb20vd2F0ZXJtYXJrLnBuZw==/dissolve/50/gravity/SouthEast/dx/10/dy/10%7Cimageslim)
就好比这样,这样就规定了自能存string类型的了 ![image](http://os78f4hny.bkt.clouddn.com/201708250006.jpg?imageMogr2/blur/1x0/quality/75%7Cwatermark/1/image/aHR0cDovL29zNzhmNGhueS5ia3QuY2xvdWRkbi5jb20vd2F0ZXJtYXJrLnBuZw==/dissolve/50/gravity/SouthEast/dx/10/dy/10%7Cimageslim)
你不用的话就是object类型,如果你定义string类型那就是string类型 一个类可以申请很多个泛型,如下图: ![image](http://os78f4hny.bkt.clouddn.com/201708250007.jpg?imageMogr2/blur/1x0/quality/75%7Cwatermark/1/image/aHR0cDovL29zNzhmNGhueS5ia3QuY2xvdWRkbi5jb20vd2F0ZXJtYXJrLnBuZw==/dissolve/50/gravity/SouthEast/dx/10/dy/10%7Cimageslim)
![image](http://os78f4hny.bkt.clouddn.com/201708250008.jpg?imageMogr2/blur/1x0/quality/75%7Cwatermark/1/image/aHR0cDovL29zNzhmNGhueS5ia3QuY2xvdWRkbi5jb20vd2F0ZXJtYXJrLnBuZw==/dissolve/50/gravity/SouthEast/dx/10/dy/10%7Cimageslim)
定制一下参数类型中的泛型类型 |