java数据结构-双向循环链表测试

package com.node;/** * @auther 付强 * @date 2020/2/14 - 13:46 */public class TestDoubleNode {    public static void main(String[] args) {        //创建节点        DoubleNode n1 = new DoubleNode(1);        DoubleNode n2 = new DoubleNode(2);        DoubleNode n3 = new DoubleNode(3);        DoubleNode n4 = new DoubleNode(4);        //追加节点        n1.after(n2);        n2.after(n3);        n3.after(n4);        //查看上一个,自己,下一个内容        System.out.println(n2.pre().getData());        System.out.println(n2.getData());        System.out.println(n2.next().getData());    }}

相关推荐