|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.grelf.Stack_<E>
public class Stack_<E>
A simple last-in-first-out (LIFO) stack, to a better OO design than Sun's one. This one has a LinkedList rather than subclassing Vector. It only exposes the behaviour that a stack should have.
| Constructor Summary | |
|---|---|
Stack_()
Construct an empty stack. |
|
| Method Summary | |
|---|---|
boolean |
isEmpty()
Tell whether the stack is empty. |
E |
peek()
Look at last value without removing it. |
E |
pop()
Get the last value, removing it from the stack. |
void |
push(E obj)
Put a new last value onto the stack. |
java.lang.String |
toString()
Get a String representation of the Stack |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Stack_()
| Method Detail |
|---|
public boolean isEmpty()
isEmpty in interface Stack<E>public E peek()
peek in interface Stack<E>public E pop()
pop in interface Stack<E>public void push(E obj)
push in interface Stack<E>public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||