Skip to content

Latest commit

 

History

History
187 lines (100 loc) · 3.24 KB

linkedstack.md

File metadata and controls

187 lines (100 loc) · 3.24 KB

dastal - v5.0.0 / LinkedStack

Class: LinkedStack<T>

A linked list implementation of the Stack interface

Type parameters

Name
T

Implements

Table of contents

Constructors

Accessors

Methods

Constructors

constructor

new LinkedStack<T>(elements?)

Instantiate the stack.

Type parameters

Name
T

Parameters

Name Type Description
elements? Iterable<T> A set of elements to initialize the stack with.

Defined in

src/stack/linkedStack.ts:11

Accessors

size

get size(): number

The number of elements in the collection.

Returns

number

Implementation of

Stack.size

Defined in

src/stack/linkedStack.ts:40

Methods

[iterator]

[iterator](): Iterator<T, any, undefined>

Receive an iterator through the stack.

Note: Unexpected behavior can occur if the collection is modified during iteration.

Returns

Iterator<T, any, undefined>

An iterator through the stack

Implementation of

Stack.[iterator]

Defined in

src/stack/linkedStack.ts:50


clear

clear(): void

Removes all elements.

Returns

void

Implementation of

Stack.clear

Defined in

src/stack/linkedStack.ts:24


peek

peek(): undefined | T

Retrieves, but does not remove, the top of the stack

Returns

undefined | T

Implementation of

Stack.peek

Defined in

src/stack/linkedStack.ts:28


pop

pop(): undefined | T

Retrieves and removes the top of the stack

Returns

undefined | T

Implementation of

Stack.pop

Defined in

src/stack/linkedStack.ts:32


push

push(element): number

Inserts an element into the stack

Parameters

Name Type
element T

Returns

number

Implementation of

Stack.push

Defined in

src/stack/linkedStack.ts:36