E - The type of Object that the stack will accept.public interface StackInterface<E>
extends java.lang.Iterable<E>
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all elements from the stack.
|
boolean |
isEmpty()
This method is called to determine if the stack is empty.
|
E |
peek()
Retrieves, but does not remove, the top of the stack.
|
E |
pop()
Retrieves and removes the element at the top of the stack.
|
void |
push(E e)
Pushed the specified element into this queue if it is possible to do so immediately without
violating capacity restrictions, otherwise, throwing an IllegalStateException
if no space is currently available or NullPointerException if the specified element is null.
|
int |
size()
This method is called to obtain the count of elements in the stack.
|
boolean isEmpty()
int size()
void push(E e) throws java.lang.IllegalStateException, java.lang.NullPointerException
e - The element to add.java.lang.IllegalStateException - If the element cannot be added at this time due to capacity restrictions.java.lang.NullPointerException - If the specified element being added is null.E peek()
E pop()
void clear()