Package project2
Interface StackInterface<T>
- Type Parameters:
T
- the type of the elements in the stack
- All Known Implementing Classes:
LinkedStack
,ResizableArrayStack
public interface StackInterface<T>
An interface for the ADT stack.
- Version:
- 1.0
- Author:
- Lindsay Kislingbury, Lea Wiranatha
-
Method Details
-
push
Adds a new entry to the top of this stack.- Parameters:
newEntry
- An object to be added to the stack.
-
pop
T pop()Removes and returns this stack's top entry.- Returns:
- The object at the top of the stack.
-
peek
T peek()Retrieves this stack's top entry.- Returns:
- The object at the top of the stack.
-
isEmpty
boolean isEmpty()Detects whether this stack is empty.- Returns:
- True if the stack is empty.
-
clear
void clear()Removes all entries from this stack.
-