package com.zhoubo.concurrent.collection;
import java.util.LinkedList;
/**
* 用linkedList实现stack(LIFO)
* @author Administrator
*
*/
public class QStack {
public LinkedList<String> stack = new LinkedList<String>();
public void add(String str){
stack.add(str);
}
public String pop(){
return stack.removeLast();
}
/**
* @param args
*/
public static void main(String[] args) {
QStack qStack = new QStack();
qStack.stack.add("jim");
qStack.stack.add("lily");
qStack.stack.add("lucy");
System.out.println(qStack.pop());
System.out.println(qStack.pop());
System.out.println(qStack.pop());
}
}
分享到:
相关推荐
Find out about Swift generators and sequences, and see how to use them to implement advanced data structures such as Stack, StackList, Queue, and LinkedList Implement sorting algorithms such as ...
This book begins by covering the basics of the JavaScript language and then moves on to discuss the most important data structures such as array, queue, stack, and linked list. You will also gain an ...
oriented programming Find out about Swift generators and sequences, and see how to use them to implement advanced data structures such as Stack, StackList, Queue, and LinkedList Implement sorting ...
(This is a little bit of a white lie, as modern routers sometimes act as firewalls or caching components, and process Transport layer as well.) Link layer switches process link and physical layers ...
We will be looking into a Linked-List, Stack, Queue, Trees, Heap, Hash-Table and Graphs. We will also be looking into Sorting, Searching techniques. In last few chapters, we will be looking into ...
Get a grasp on the basics of abstract data types—stack, queue, and double ended queue See how to use recursive functions and immutability while understanding and in terms of recursion Handle reactive...
- **Message Queue**: Windows maintains a message queue for each thread. Messages are placed in the queue and retrieved by the message loop. - **Message Loop**: The message loop retrieves messages from...
Pointerscan for value scans now add the results to the overflow queue Opening a file and changing bytes do not change them to the file anymore (you need to explicitly save now) Added an option to the ...
code size, and reduces CPU stack use. (Valery Podrezov + interpreter changes in version 20051202 that eliminated namespace loading during the pass one parse.) Implemented _CID support for PCI Root ...
<END><br>11,Recursion.zip A VB application which demonstrates Recursion.<END><br>12,StacksQs.zip The Stack and Queue data structures are presented in this VB application. <END><br>13,...
The 886 Processor 3.3.11 - The 8286 Processor 3.3.12 - The 8486 Processor 3.3.12.1 - The 8486 Pipeline 3.3.12.2 - Stalls in a Pipeline 3.3.12.3 - Cache, the Prefetch Queue, and the ...
PEP 3105: print As a Function PEP 3110: Exception-Handling Changes PEP 3112: Byte Literals PEP 3116: New I/O Library PEP 3118: Revised Buffer Protocol PEP 3119: Abstract Base Classes PEP 3127: ...
2. SQL的`DELETE`命令可以直接删除数据库表中的记录,但在Visual FoxPro中,使用SQL命令删除记录前需先用`USE`命令打开表,这是对数据库操作的基本规则。而传统的Visual FoxPro `DELETE`命令则是直接对当前打开的表...
The C++ Standard Library A Tutorial and Reference (2nd Edition)+cppstdlib-code.zip C++标准库(第二版)英文版.pdf 非扫描版+源代码 Prefaceto the SecondEdition xxiii Acknowledgments for the Second...
How to Use This Book ................................................................................................................. 4 The Featured Programs ............................................
1.1.2 as操作符——引用类型转换 3 1.1.3 base关键字——从派生类中访问基类的成员 3 1.1.4 变量——存储特定类型的数据 4 1.1.5 Console类——控制台中的输入流、输出流和错误流 6 1.1.6 Convert类——类型转换 8 ...