直接源代码 public class LinkedList<E>{ private Node head; private int size; private class Node{ E data; Node prev; Node next; public Node(E e) { data = e; } } //向集合中追加元素 public boolean add(E e) { if(head==null) { head = new Node(e); //建立双向循环关系 head.next = head; head.prev = head; }else {//第二个以后的节点 Node last = head.prev; Node node = new Node(e); last.next = node; node.next = head; head.prev = node; node.prev = last; } size++; return true; } public int size() { return size; } public E get(int index) { if(index<0 || index > size-1) { throw new IndexOutOfBoundsException("越界!"+index); } return find(index).data; } public E remove(int index) { if(index<0 || index > size-1) { throw new IndexOutOfBoundsException("越界!"+index); } if(size==1 && index==0) {