T - the type of elements maintained by this Collectionpublic interface Stack<T>
push(Object), pop() function,
with a fast clear() function.
The peek(int) function allows to view the contents of the stack (top to bottom).| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the stack
|
T |
peek(int index)
Provides the Selected Object from the stack.
|
T |
pop()
Removes the Object on top of the stack.
|
void |
push(T e)
Inserts a given Object on top of the stack
|
int |
size()
Provides the amount of elements currently in the stack
|
default T |
top()
Provides the Object on top of the stack
|
void push(T e)
e - the Object to insertT pop()
java.lang.ArrayIndexOutOfBoundsException - if the stack is emptyint size()
void clear()
default T top()
java.lang.ArrayIndexOutOfBoundsException - if the stack is emptyT peek(int index)
index - of the element that should be providedjava.lang.ArrayIndexOutOfBoundsException - if the index is out of bounds