Package utilities
Interface StackADT<E>
- Type Parameters:
E
- The type of elements in this stack
- All Known Implementing Classes:
MyArrayList
public interface StackADT<E>
An interface representing the Stack Abstract Data Type.
-
Method Summary
-
Method Details
-
push
Returns the data of the element to the last position- Parameters:
element
- The element to be pushed onto the stack- Throws:
NullPointerException
- If the specified element is null
-
pop
Removes the element in the last position- Returns:
- The top element of this stack
- Throws:
NoSuchElementException
- If this stack is empty
-
peek
Returns the data of the element to the last position- Returns:
- The top element of this stack
- Throws:
NoSuchElementException
- If this stack is empty
-