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 Summary

    Modifier and Type
    Method
    Description
    void
    Removes all entries from this stack.
    boolean
    Detects whether this stack is empty.
    Retrieves this stack's top entry.
    pop()
    Removes and returns this stack's top entry.
    void
    push(T newEntry)
    Adds a new entry to the top of this stack.
  • Method Details

    • push

      void push(T newEntry)
      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.