|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--AStack
AStack.java
Illustrates the implementation of a stack based on an ArrayList.
Created: Mon Mar 24 11:26:05 2003
| Constructor Summary | |
AStack()
Creates a new AStack instance. |
|
AStack(int initialCapacity)
Creates a new AStack instance
with the given initial capacity. |
|
| Method Summary | |
boolean |
empty()
Determines if this AStack is empty. |
Object |
pop()
Removes and returns the Object on the top of this AStack. |
void |
push(Object obj)
Adds a new Object to the top of this AStack. |
Object |
top()
Returns the Object on the top of this AStack. |
String |
toString()
Returns a String representation of this AStack, with the top Object shown at the left. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public AStack()
AStack instance.
public AStack(int initialCapacity)
AStack instance
with the given initial capacity.
initialCapacity - the initial capacity of this AStack.| Method Detail |
public boolean empty()
public void push(Object obj)
obj - the Object to be pushed onto this AStack.
public Object top()
throws NoSuchElementException
Object on the top of this AStack.
NoSuchElementException - if this AStack is empty.
public Object pop()
throws NoSuchElementException
Object that was on the top of this
AStack, after removing it.
NoSuchElementException - if this AStack is empty.public String toString()
toString in class ObjectString representation of this AStack.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||