Skip to content

Latest commit

 

History

History
187 lines (100 loc) · 3.22 KB

arraystack.md

File metadata and controls

187 lines (100 loc) · 3.22 KB

dastal - v5.0.0 / ArrayStack

Class: ArrayStack<T>

An implementation of the Stack interface using an array

Type parameters

Name
T

Implements

Table of contents

Constructors

Accessors

Methods

Constructors

constructor

new ArrayStack<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/arrayStack.ts:10

Accessors

size

get size(): number

The number of elements in the collection.

Returns

number

Implementation of

Stack.size

Defined in

src/stack/arrayStack.ts:36

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/arrayStack.ts:46


clear

clear(): void

Removes all elements.

Returns

void

Implementation of

Stack.clear

Defined in

src/stack/arrayStack.ts:20


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/arrayStack.ts:24


pop

pop(): undefined | T

Retrieves and removes the top of the stack

Returns

undefined | T

Implementation of

Stack.pop

Defined in

src/stack/arrayStack.ts:28


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/arrayStack.ts:32