[Source] Read LinkedList

Copyright: https://blog.csdn.net/qq_21852449/article/details/85225775
  1. data structure
    Here Insert Picture Description
  2. Inheritance & realization
  3. Attributes
    //大小
    transient int size;
    //第一个节点
    transient LinkedList.Node<E> first;
    //最后一个节点
    transient LinkedList.Node<E> last;
  1. Construction method
	//默认长度为0
    public LinkedList() {
        this.size = 0;
    }
	//可传入Collection
    public LinkedList(Collection<? extends E> var1) {
        this();
        this.addAll(var1);
    }
  1. method
public E getFirst() {...}
public E getLast() {...}
public E removeFirst() {...}
public E removeLast() {...}
public void addFirst(E e){...}
public void addLast(E e){...}
public boolean remove(Object var){...}
  1. Summary
    LinkedList is a linked list data structure to achieve, when the need for frequent insertion, deletion when performance is stronger than LinkedList ArrayList. From its implementation can be seen in the interface LinkedList a doubly linked list (Deque). Linked in JDK1.8 is achieved by the internal nodes represent classes.

Guess you like

Origin blog.csdn.net/qq_21852449/article/details/85225775