|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectstructure.AbstractStructure
structure.AbstractLinear
structure.AbstractStack
structure.StackList
public class StackList
An implementation of a stack, based on lists. The head of the stack is stored at the head of the list.
| Constructor Summary | |
|---|---|
StackList()
Construct an empty stack. |
|
| Method Summary | |
|---|---|
void |
add(Object value)
Add a value to the top of the stack. |
void |
clear()
Remove all elements from the stack. |
boolean |
empty()
Determine if the stack is empty. |
Object |
get()
Get a reference to the top value in the stack. |
Iterator |
iterator()
Returns an iterator for traversing the structure. |
Object |
remove()
Remove a value from the top of the stack. |
int |
size()
Determine the number of elements in the stack. |
String |
toString()
Construct a string representation of the stack. |
| Methods inherited from class structure.AbstractStack |
|---|
getFirst, peek, pop, push |
| Methods inherited from class structure.AbstractLinear |
|---|
remove |
| Methods inherited from class structure.AbstractStructure |
|---|
contains, elements, hashCode, isEmpty, values |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface structure.Stack |
|---|
getFirst, peek, pop, push |
| Methods inherited from interface structure.Structure |
|---|
contains, elements, isEmpty, remove, values |
| Constructor Detail |
|---|
public StackList()
| Method Detail |
|---|
public void clear()
clear in interface Structurepublic boolean empty()
empty in interface Linearempty in interface Stackempty in class AbstractLinearAbstractStructure.isEmpty()public Iterator iterator()
Structure
iterator in interface StructureAbstractIterator,
Iterator,
Enumeration,
Structure.elements()public Object get()
get in interface Linearget in interface Stackpublic void add(Object value)
add in interface Linearadd in interface Stackadd in interface Structureitem - The value to be added.AbstractStack.push(java.lang.Object)public Object remove()
remove in interface Linearremove in interface StackAbstractStack.pop()public int size()
size in interface Linearsize in interface Stacksize in interface Structurepublic String toString()
toString in class Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||