并不需要其他复杂功能, 能正向读取和反向读取即可class Link {
    public int data1;
    public double data2;
    public Link nextLink;    //Link constructor
    public Link(int d1, double d2) {
            data1 = d1;
            data2 = d2;
    }    //Print Link data
    public void printLink() {
            System.out.print("{" + data1 + ", " + data2 + "} ");
    }
}class LinkList {
    private Link first;    //LinkList constructor
    public LinkList() {
            first = null;
    }    //Returns true if list is empty
    public boolean isEmpty() {
            return first == null;
    }    //Inserts a new Link at the first of the list
    public void insert(int d1, double d2) {
            Link link = new Link(d1, d2);
            link.nextLink = first;
            first = link;
    }    //Deletes the link at the first of the list
    public Link delete() {
            Link temp = first;
            first = first.nextLink;
            return temp;
    }    //Prints list data
    public void printList() {
            Link currentLink = first;
            System.out.print("List: ");
            while(currentLink != null) {
                    currentLink.printLink();
                    currentLink = currentLink.nextLink;
            }
            System.out.println("");
    }
}  class LinkListTest {
    public static void main(String[] args) {
            LinkList list = new LinkList();            list.insert(1, 1.01);
            list.insert(2, 2.02);
            list.insert(3, 3.03);
            list.insert(4, 4.04);
            list.insert(5, 5.05);            list.printList();            while(!list.isEmpty()) {
                    Link deletedLink = list.delete();
                    System.out.print("deleted: ");
                    deletedLink.printLink();
                    System.out.println("");
            }
            list.printList();
    }
}

解决方案 »

  1.   

    java.util.LinkedList 就是一个双向链表,看看src.zip 里的代码
      

  2.   

    LinkedList的Entry是不可见的,Entry.previous你也是无法直接调用的。
    如果lz是想学习的话,看JDK源代码绝对是不二选择;
    如果lz是想使用的话,还得自己写。
      

  3.   

    每一个节点
    class Entry<T> {
        T value;
        Entry<T> prev;  // 单向没有这个
        Entry<T> next;  // 单向只有这个
    }
      

  4.   


    http://webservices.ctocio.com.cn/184/11547184_2.shtml看看吧
      

  5.   


    public class MyList {
    private Object data;
    public MyList prev;
    public MyList next;
    MyList(){
    prev = null;
    next = null;
    }
    public void setData(Object d){
    data = d;
    }
    public Object getData(){
    return data;
    }
    public static void insertBack(MyList head, MyList node){
    while(head.next != null){
    head = head.next;
    }
    node.prev = head;
    head.next = node;
    node.next = null;
    }
    }
    public class Test {
    public static void main(String[] args){
    MyList head = new MyList(), test = new MyList(), tail = new MyList();
    head.setData("list head");
    test.setData("mid");
    tail.setData("tail");
    MyList.insertBack(head, test);
    MyList.insertBack(head, tail);
    System.out.println(test.prev.getData());
    System.out.println(test.next.getData());
    }}仿照C语言的写了一个