LinkedList基于双向链表实现的java
private static class Node<E> { E item; Node<E> next; Node<E> prev; }
每一个链表存储了 first 和 last 指针:数组
transient Node<E> first; transient Node<E> last;
Vector:指针
public synchronized boolean add(E e) { modCount++; ensureCapacityHelper(elementCount + 1); elementData[elementCount++] = e; return true; } public synchronized E get(int index) { if (index >= elementCount) throw new ArrayIndexOutOfBoundsException(index); return elementData(index); }
ArrayList与LinkedList、Vector的区别:code