LinkedList总结
 
 
LinkedList分点详解
 
LinkedList继承实现情况
 

 
LinkedList数据结构
 
- 链表节点类型为内部类
 
 
private static class Node<E> {
        E item;
        Node<E> next;
        Node<E> prev;
        Node(Node<E> prev, E element, Node<E> next) {
            this.item = element;
            this.next = next;
            this.prev = prev;
        }
    }
 
- 默认新增数据就是直接在链表终端添加元素
 
 
public boolean add(E e) {
        linkLast(e);
        return true;
    }
void linkLast(E e) {
		
        final Node<E> l = last;
        
        final Node<E> newNode = new Node<>(l, e, null);
        
        last = newNode;
        if (l == null)
            first = newNode;
        else
            l.next = newNode;
        size++;
        modCount++;
    }