| Constructor and Description |
|---|
AStack()
This default constructor initializes the internal array to the size of 10.
|
AStack(int capacity)
This constructor initializes the internal array to the size specified by
capacity.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
empty() |
T |
peek()
Peek at the top of this Stack.
|
T |
pop()
Pop out the item at the top of this Stack.
|
T |
push(T item)
Push the item on the top of this Stack.
|
int |
size()
This is not required by the standard API of Stack.
|
public AStack()
public AStack(int capacity)
capacity - the maximum size of the stack.public T push(T item)
Stackpublic T pop()
Stackpublic boolean empty()
public int size()