栈堆后进先出,队列先进后出

版权声明:欢迎转载 https://blog.csdn.net/weixin_33387378/article/details/87633005
LinkedList<Integer> linkedList = new LinkedList<>();
        linkedList.add(1);
        linkedList.add(2);
        linkedList.add(3);
        System.out.println(linkedList);
        linkedList.add(4);
        System.out.println(linkedList);
        linkedList.pop();
        System.out.println(linkedList);
[1, 2, 3]
[1, 2, 3, 4]
[2, 3, 4]

 

展开阅读全文

没有更多推荐了,返回首页