|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object structure.AbstractStructure structure.AbstractLinear structure.AbstractStack structure.StackVector
public class StackVector
An implementation of stacks using Vectors.
Constructor Summary | |
---|---|
StackVector()
Construct an empty stack. |
|
StackVector(int size)
Construct a stack with initial capacity Vector will grow if the stack fills vector. |
Method Summary | |
---|---|
void |
add(Object item)
Add an element from the top of the stack. |
void |
clear()
Remove all elements from stack. |
Object |
get()
Fetch a reference to the top element of the stack. |
boolean |
isEmpty()
Returns true iff the stack is empty. |
Iterator |
iterator()
Returns an iterator for traversing the structure. |
Object |
remove()
Remove an element from the top of the stack. |
int |
size()
Determine the number of elements in stack. |
String |
toString()
Construct a string representation of stack. |
Methods inherited from class structure.AbstractStack |
---|
getFirst, peek, pop, push |
Methods inherited from class structure.AbstractLinear |
---|
empty, remove |
Methods inherited from class structure.AbstractStructure |
---|
contains, elements, hashCode, values |
Methods inherited from class java.lang.Object |
---|
equals, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface structure.Stack |
---|
empty, getFirst, peek, pop, push |
Methods inherited from interface structure.Structure |
---|
contains, elements, remove, values |
Constructor Detail |
---|
public StackVector()
public StackVector(int size)
size
- The initial capacity of the vector.Method Detail |
---|
public void add(Object item)
add
in interface Linear
add
in interface Stack
add
in interface Structure
item
- The element to be added to the stack top.Stack.push(java.lang.Object)
public Object remove()
remove
in interface Linear
remove
in interface Stack
AbstractStack.pop()
public Object get()
get
in interface Linear
get
in interface Stack
public boolean isEmpty()
isEmpty
in interface Structure
isEmpty
in class AbstractStructure
public int size()
size
in interface Linear
size
in interface Stack
size
in interface Structure
public void clear()
clear
in interface Structure
public Iterator iterator()
Structure
iterator
in interface Structure
AbstractIterator
,
Iterator
,
Enumeration
,
Structure.elements()
public String toString()
toString
in class Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |