Skip to content

MutableArray

@algorandfoundation/algorand-typescript


@algorandfoundation/algorand-typescript / index / MutableArray

Class: MutableArray<TItem>

Defined in: packages/algo-ts/src/mutable-array.ts:7

An in memory mutable array which is passed by reference

Type Parameters

TItem

Indexable

[index: uint64]: TItem

Constructors

new MutableArray()

new MutableArray<TItem>(…items): MutableArray<TItem>

Defined in: packages/algo-ts/src/mutable-array.ts:12

Create a new MutableArray with the specified items

Parameters

items

TItem[]

The initial items for the array

Returns

MutableArray<TItem>

Accessors

length

Get Signature

get length(): uint64

Defined in: packages/algo-ts/src/mutable-array.ts:17

Returns the current length of this array

Returns

uint64

Methods

[iterator]()

[iterator](): IterableIterator<TItem>

Defined in: packages/algo-ts/src/mutable-array.ts:57

Returns an iterator for the items in this array

Returns

IterableIterator<TItem>


at()

at(index): TItem

Defined in: packages/algo-ts/src/mutable-array.ts:26

Returns the item at the given index. Negative indexes are taken from the end.

Parameters

index

Uint64Compat

The index of the item to retrieve

Returns

TItem


copy()

copy(): MutableArray<TItem>

Defined in: packages/algo-ts/src/mutable-array.ts:99

Create a copy of this array

Returns

MutableArray<TItem>


entries()

entries(): IterableIterator<readonly [uint64, TItem]>

Defined in: packages/algo-ts/src/mutable-array.ts:64

Returns an iterator for a tuple of the indexes and items in this array

Returns

IterableIterator<readonly [uint64, TItem]>


keys()

keys(): IterableIterator<uint64>

Defined in: packages/algo-ts/src/mutable-array.ts:71

Returns an iterator for the indexes in this array

Returns

IterableIterator<uint64>


pop()

pop(): TItem

Defined in: packages/algo-ts/src/mutable-array.ts:92

Pop a single item from this array

Returns

TItem


push()

push(…items): void

Defined in: packages/algo-ts/src/mutable-array.ts:85

Push a number of items into this array

Parameters

items

TItem[]

The items to be added to this array

Returns

void


slice()

Call Signature

slice(): MutableArray<TItem>

Defined in: packages/algo-ts/src/mutable-array.ts:34

Internal

Create a new Dynamic array with all items from this array Not supported yet

Returns

MutableArray<TItem>

Call Signature

slice(end): MutableArray<TItem>

Defined in: packages/algo-ts/src/mutable-array.ts:41

Internal

Create a new MutableArray with all items up till end. Negative indexes are taken from the end.

Parameters
end

Uint64Compat

An index in which to stop copying items. Not supported yet

Returns

MutableArray<TItem>

Call Signature

slice(start, end): MutableArray<TItem>

Defined in: packages/algo-ts/src/mutable-array.ts:49

Internal

Create a new MutableArray with items from start, up until end Negative indexes are taken from the end.

Parameters
start

Uint64Compat

An index in which to start copying items.

end

Uint64Compat

An index in which to stop copying items Not supported yet

Returns

MutableArray<TItem>