GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • algorithms-ts
  • Options
  • Queue

This view

  • Original page
  • New address

GeezerVison is showing prishedko.github.io — Stack | algorithms-ts

The Stack class represents a last-in-first-out (LIFO) stack of generic items. It supports the usual

push and pop operations, along with methods for peeking at the top item. Also it extends

Collection API for iteration and testing whether the Stack is empty.

Type parameters

  • E

Hierarchy

  • Stack

Implemented by

  • LinkedStack

Index

Methods

  • asCollection
  • isEmpty
  • peek
  • pop
  • push
  • size
  • toString

Methods

asCollection

  • asCollection(): Collection<E>
    • Defined in containers/api.ts:52

    Returns collection backed by this stack. Iterations will be in LIFO order. Time complexity is O(1).

    Returns Collection<E>

    collection of elements from this stack.

isEmpty

  • isEmpty(): boolean
    • Defined in containers/api.ts:41

    Returns true if this stack is empty.

    Returns boolean

    true if this stack is empty; false otherwise

peek

  • peek(): E
    • Defined in containers/api.ts:31

    Returns (but does not remove) the item most recently added to this stack.

    throws

    Error('Stack underflow') if this stack is empty

    Returns E

    the element most recently added to this stack.

pop

  • pop(): E
    • Defined in containers/api.ts:25

    Removes and returns the item most recently added to this stack.

    throws

    Error('Stack underflow') if this stack is empty

    Returns E

    the element most recently added.

push

  • push(element: E): Stack<E>
    • Defined in containers/api.ts:19

    Adds the item to this stack.

    Parameters

    • element: E

      the element to add

    Returns Stack<E>

    this stack

size

  • size(): number
    • Defined in containers/api.ts:47

    Returns the number of elements in the stack.

    Returns number

    the number of elements in the stack

toString

  • toString(): string
    • Defined in containers/api.ts:36

    Returns a string representation of this stack.

    Returns string

    the sequence of elements in the stack in LIFO order, separated by spaces

Generated using TypeDoc

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.