|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcomputer.Stack<T>
T
- the type of element storedpublic class Stack<T>
A LIFO storage structure. Useful in such things as language translation and in execution of arithmetic expressions. Insertions are only at the "top". Removals are only at the "top".
Field Summary | |
---|---|
private apcsGeneric.jbergin.DenseList<T> |
storage
|
Constructor Summary | |
---|---|
Stack()
|
Method Summary | |
---|---|
boolean |
isEmpty()
Tells if the structure is empty. |
T |
pop()
Remove and return the item most recently pushed that has not yet been popped |
void |
push(T element)
Enter an item into the storage at the top. |
T |
top()
Get a reference to the top of the stack without removing it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private apcsGeneric.jbergin.DenseList<T> storage
Constructor Detail |
---|
public Stack()
Method Detail |
---|
public void push(T element)
element
- the item to be insertedpublic T pop()
java.lang.IllegalStateException
- if the stack is emptypublic T top()
java.lang.IllegalStateException
- if the stack is emptypublic boolean isEmpty()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |