|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.marringtons.util.Stack
A stack is a simple array where data is always pushed to and popped off the end.
stack = new Stack(); stack.push( "one"); stack.isEmpty() == false; stack.size() == 1; stack.push( "two"); ((String) stack.peek()).equals( "two"); ((String) stack.pop()).equals( "two"); ((String) stack.peek()).equals( "one"); stack.clear(); stack.isEmpty() == true;
| Constructor Summary | |
Stack()
|
|
| Method Summary | |
void |
clear()
Empty stack - releasing all references. |
boolean |
isEmpty()
Return true only if the stack is devoid of items. |
Object |
peek()
Return the object on the top of the stack (without changint the stack pointer). |
Object |
pop()
Pop an object from the stack. |
void |
push(Object item)
Push an object onto the stack (enlarging it if necessary). |
int |
size()
Return the number of items currently on the stack. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Stack()
| Method Detail |
public void push(Object item)
item - to pushpublic Object pop()
public Object peek()
public int size()
public boolean isEmpty()
public void clear()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||