⑴,实现了List接口,允许null元素。LinkedList还为链表开头和结尾提供了操作,所以使用LinekedList可以用作堆栈、列队或双端队列。
⑵,LinkedList实现Deque接口,提供了基于队列的先进先出序列的实现。
⑶,所有的操作都是依照两重链表来实现的。
⑷,操作为非线程安全的,如果多个线程中,存在修改链表结构的操作,则必须保证线程安全。
2,LinkedList继承AbstractSequentialList实现Lise、Deque、Cloneable、Serializable接口。
public class LinkedList<E>
extends AbstractSequentialList<E>
implements List<E>, Deque<E>, Cloneable, java.io.Serializable
⑵,Deque继承自Queue,定义了队列接口操作。Queue接口继承Collection接口。
3,AbstractSequentialList类详解:
此类提供了List接口的主要实现。
public E remove(int index) {
try {
ListIterator<E> e = listIterator(index);
E outCast = e.next();
e.remove();
return outCast;
} catch (NoSuchElementException exc) {
throw new IndexOutOfBoundsException("Index: "+index);
}
}
public E set(int index, E element) {
E oldVal = e.next();
e.set(element);
return oldVal;
}
3,LinkedList成员变量: