LinkedList简介
| 1 | public class LinkedList<E> | 
- LinkedList基于链表实现,还是双向链表
- LinkedList可以当做栈、队列和双向队列
- LinkedList线程不安全
继承关系
| 1 | LinkedList 继承 AbstractSequentialList<E> | 
实现接口
| 1 | 实现 Serializable, Cloneable, Iterable<E>, Collection<E>, Deque<E>, List<E>, Queue<E> | 
LinkedList方法(API)
| 1 | boolean add(E object) | 
LinkedList源码分析
| 1 | public class LinkedList<E> | 
总结
- LinkedList 底层实现是双向链表
- LinkedList 实现了List 、 Queue 、Serializable 和 Cloneable 接口
- LinkedList 允许元素为 null
- LinkedList 线程不安全,单线程使用
- LinkedList 查找和删除元素的时候,分该元素是 null 和不是 null 来处理
- LinkedList 可以当做列表 栈 队列 双端队列来使用
- LinkedList 插入 删除 效率较高,查找效率低(遍历整个链表)
- 1.6 和 1.7 中 LinkedList 的区别1 
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 431.6 使用的是Entry存储 
 // 双向链表的节点所对应的数据结构。
 // 包含3部分:上一节点,下一节点,当前节点值。
 private static class Entry<E> {
 E element; // 当前节点所包含的值
 Entry<E> next; // 下一个节点
 Entry<E> previous; // 上一个节点
 /**
 * 链表节点的构造函数。
 * 参数说明:
 * element —— 节点所包含的数据
 * next —— 下一个节点
 * previous —— 上一个节点
 */
 Entry(E element, Entry<E> next, Entry<E> previous) {
 this.element = element;
 this.next = next;
 this.previous = previous;
 }
 }
 1.7使用的是Node存储
 // 双向链表的节点所对应的数据结构。
 // 包含3部分:上一节点,下一节点,当前节点值。
 private static class Node<E> {
 E item; // 当前节点所包含的值
 Node<E> next;// 下一个节点
 Node<E> prev; // 上一个节点
 /**
 * 链表节点的构造函数。
 * 参数说明:
 * element —— 节点所包含的数据
 * next —— 下一个节点
 * previous —— 上一个节点
 */
 Node(Node<E> prev, E element, Node<E> next) {
 this.item = element;
 this.next = next;
 this.prev = prev;
 }
 }
参考
https://blog.csdn.net/u010648555/article/details/58680439
https://github.com/zxiaofan/JDK/blob/master/JDK1.8/src/java/util/LinkedList.java
