|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecttips.collectionTest.ReversibleStack
This class demonstrates the use of the collection classes. This object implements a reversible stack, hence it implements the usual pop() push() methods but will also implement reverse() and sort().
| Field Summary | |
private int |
m_nCount
|
private java.util.List |
m_TheStack
Stack implementation is done using a linked list |
| Constructor Summary | |
ReversibleStack()
Creates a new instance of ReversibleStack |
|
ReversibleStack(java.lang.Object[] arr)
Create a mew instance of ReversibleStack initialing with the element of the array |
|
| Method Summary | |
static void |
main(java.lang.String[] args)
Main Code - used to test the class |
java.lang.Object |
pop()
Provides Pop functionality for the stack |
void |
print()
Debug method to print the contents of the stack |
boolean |
push(java.lang.Object o)
Provides Push functionaliy. |
void |
reverse()
Method that reverses the contents of the Stack |
void |
sort()
Function to sort the contents of the stack |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private java.util.List m_TheStack
private int m_nCount
| Constructor Detail |
public ReversibleStack()
public ReversibleStack(java.lang.Object[] arr)
| Method Detail |
public boolean push(java.lang.Object o)
o - The object to be pushed on to the stack.
public java.lang.Object pop()
None.public void reverse()
public void sort()
public void print()
public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||