public final class ArrayStack<T> extends Object
| Constructor and Description |
|---|
ArrayStack() |
ArrayStack(int initialCapacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all of the elements from this stack.
|
boolean |
empty()
Tests if this stack is empty.
|
T |
peek()
Looks at the object at the top of this stack without removing it from the stack.
|
T |
peek(int offset) |
T |
pop()
Removes the object at the top of this stack and returns that object as the value of this function.
|
T |
push(T element)
Pushes an item onto the top of this stack.
|
int |
size()
Returns the number of elements in this stack.
|
public boolean empty()
public void clear()
public int size()
public T push(T element)
element - - the element to be pushed onto this stackpublic T pop() throws EmptyStackException
EmptyStackException - - if this queue is emptypublic T peek() throws EmptyStackException
EmptyStackException - - if this stack is empty.public T peek(int offset) throws IndexOutOfBoundsException
IndexOutOfBoundsExceptionCopyright © 2016 jetbrick. All rights reserved.