Interface StackInterface<T>
- All Known Implementing Classes:
StackInfinitePush
public interface StackInterface<T>
-
Method Summary
-
Method Details
-
push
Adds a new entry to the top of this stack.- Parameters:
element
- element to be added to the stack
-
pop
T pop()Removes and returns this stack's top entry. The size of the stack is decreased by one.- Returns:
- The element at the top of the stack.
- Throws:
EmptyStackException
- if the stack is empty when the method is invoked
-
peek
T peek()Get this stack's top entry. The size of the stack is not changed.- Returns:
- The element at the top of the stack.
- Throws:
EmptyStackException
- if the stack is empty
-
isEmpty
boolean isEmpty()Determines if there are any elements in the stack.- Returns:
- True if the stack is empty.
-
clear
void clear()Removes all entries from the stack.
-