Queue and stack
来源:互联网 发布:显卡软件超频 编辑:程序博客网 时间:2024/05/16 10:45
@Test
public void testChar(){
Queue<String> queue= new LinkedList<String>();
queue.offer("a");
queue.offer("b");
queue.offer("c");
queue.offer("d");
queue.offer("e");
System.out.println("队列中的元素是:"+queue);
queue.poll();
System.out.println("队列中的元素是:"+queue);
String peek = queue.peek();
System.out.println(peek);
System.out.println("队列中的元素是:"+queue);
Stack<String> stack=new Stack<String>();
stack.push("11");
stack.push("12");
stack.push("13");
stack.push("14");
stack.push("15");
System.out.println("栈中的元素是:"+stack);
System.out.println(stack.peek());
stack.pop();
System.out.println("pop后栈中的元素是:"+stack);
}
public void testChar(){
Queue<String> queue= new LinkedList<String>();
queue.offer("a");
queue.offer("b");
queue.offer("c");
queue.offer("d");
queue.offer("e");
System.out.println("队列中的元素是:"+queue);
queue.poll();
System.out.println("队列中的元素是:"+queue);
String peek = queue.peek();
System.out.println(peek);
System.out.println("队列中的元素是:"+queue);
Stack<String> stack=new Stack<String>();
stack.push("11");
stack.push("12");
stack.push("13");
stack.push("14");
stack.push("15");
System.out.println("栈中的元素是:"+stack);
System.out.println(stack.peek());
stack.pop();
System.out.println("pop后栈中的元素是:"+stack);
}
0 0
- stack and queue
- Queue and Stack
- Queue and stack
- Stack and Queue
- List, Queue and Stack
- Stack and Queue
- usage of stack and queue
- queue by one stack、two stack and three stack
- Stack and Queue Base on LinkedList
- 栈与队列(queue and stack)
- Selection Sort with stack and queue
- Insertion Sort with queue and stack
- Stack and Queue 栈和队列
- My understand of stack and queue
- stack-structured algorithm and queue-structured algorithm
- stack,queue
- Queue\Stack
- queue stack
- Oracle 11g导出的dmp文件导入到10g
- POJ 3352|Road Construction|边双联通分量|Tarjan
- 利用c语言绘制漫天星空-动画
- 2015年阿里巴巴中间件比赛rpc框架
- SVN图标不显示的2种处理方式
- Queue and stack
- 归并排序
- dd命令的简单用法
- PHP之include载入文件
- Redis教程(十五):C语言连接操作代码实例
- 百度迁徙背后数据瓦片规则分析(自定义图层)
- 前端开发-切图初了解
- Objective-C内存管理
- NYoj 2 括号配对问题(栈)