?? stack.java
字號:
package wapide;
import java.lang.*;
import java.util.*;
/**
* A helper class that simulates a stack object.
* Copyright (c) 2003
* @author Mark Busman
* @version 1.0
*
* For License and contact information see WAPIDE.java
*/
public class Stack extends Object {
/**
* The number of itmes on the stack.
*/
private int StackCounter = -1;
/**
* The actual stack object.
*/
private ArrayList theStack = new ArrayList();
/** Creates new Stack */
public Stack() {
}
/** Push an object onto the stack.
* @param Object o - Any class as long as it is cast to an Object.
*/
public void Push(Object o) {
StackCounter++;
theStack.add(o);
}
/** Pop's an object off the top of the stack.
* @return Object o
*/
public Object Pop() {
Object remObj = new Object();
if (StackCounter > -1) {
remObj = theStack.remove(StackCounter);
StackCounter--;
}
return remObj;
}
/** Checks to see if the stack is empty.
* @return boolean - If true the stack is empty.
*/
public boolean StackNotEmpty() {
if (StackCounter > -1)
return true;
else
return false;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -