public class DoubleNode {
DoubleNode pre = this; //前一个节点 -- 指向自己
DoubleNode next = this; //下一个节点 -- 指向自己
int data;
public DoubleNode(int data) {
this.data = data;
}
//获取数据
public int getData() {
return this.data;
}
//查看下一个节点
public DoubleNode next() {
return this.next;
}
//查看上一个节点
public DoubleNode pre() {
return this.pre;
}
//追加节点
public void insert(DoubleNode node){
DoubleNode nextNext = next;
this.next = node;
node.pre = this;
node.next = nextNext;
nextNext.pre = node;
}
}
版权声明:本文为qq_41409907原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。