|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--LStack
LStack.java
Illustrates the implementation of a stack based on a linked list.
Created: Mon Mar 24 10:37:56 2003
| Constructor Summary | |
LStack()
Creates a new LStack instance. |
|
| Method Summary | |
boolean |
empty()
Determines if this LStack is empty. |
Object |
pop()
Removes and returns the Object on the top of this LStack. |
void |
push(Object obj)
Adds a new Object to the top of this LStack. |
Object |
top()
Returns the Object on the top of this LStack. |
String |
toString()
Returns a String representation of this LStack, 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 LStack()
LStack instance.
| Method Detail |
public boolean empty()
public void push(Object obj)
obj - the Object to be pushed onto this LStack.
public Object top()
throws NoSuchElementException
Object on the top of this LStack.
NoSuchElementException - if this LStack is empty.
public Object pop()
throws NoSuchElementException
Object that was on the top of this
LStack, after removing it.
NoSuchElementException - if this LStack is empty.public String toString()
toString in class ObjectString representation of this LStack.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||