public class LinkedStack<E> extends java.lang.Object implements StackInterface<E>
| Constructor and Description |
|---|
LinkedStack() |
| 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.
|
java.util.Iterator<E> |
iterator() |
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.
|
public java.util.Iterator<E> iterator()
iterator in interface java.lang.Iterable<E>public boolean isEmpty()
StackInterfaceisEmpty in interface StackInterface<E>public int size()
StackInterfacesize in interface StackInterface<E>public void push(E e) throws java.lang.IllegalStateException, java.lang.NullPointerException
StackInterfacepush in interface StackInterface<E>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.public E peek()
StackInterfacepeek in interface StackInterface<E>public E pop()
StackInterfacepop in interface StackInterface<E>public void clear()
StackInterfaceclear in interface StackInterface<E>