Interface representing a generic Stack ADT.

Type Parameters

  • T

Implements

Constructors

Accessors

Methods

Constructors

Accessors

Methods

  • Returns true if the collection is empty.

    Returns boolean

    True if the collection is empty, otherwise false.

  • Returns the top element without removing it

    Returns undefined | T

    The top element of stack, or undefined if stack is empty.

  • Removes and returns the top element of the stack

    Returns undefined | T

    The removed element, or undefined if stack is empty.

  • Adds an element to the top of the stack

    Parameters

    • item: T

      The element to add.

    Returns void