Skip to content
Effect Days 2026 Get your ticket

MutableList

15 exports Added in v0.0.1 Source

Concatenating

append

Added in v2.0.0 Source

Appends the specified element to the end of the MutableList.

Signature

declare const append: {
<A>(value: A): (self: MutableList<A>) => MutableList<A>;
<A>(self: MutableList<A>, value: A): MutableList<A>;
}

prepend

Added in v2.0.0 Source

Prepends the specified value to the beginning of the list.

Signature

declare const prepend: {
<A>(value: A): (self: MutableList<A>) => MutableList<A>;
<A>(self: MutableList<A>, value: A): MutableList<A>;
}

Constructors

empty

Added in v2.0.0 Source

Creates an empty MutableList.

Signature

declare function empty<A = never>(): MutableList<A>

fromIterable

Added in v2.0.0 Source

Creates a new MutableList from an iterable collection of values.

Signature

declare function fromIterable<A>(iterable: Iterable<A>): MutableList<A>

make

Added in v2.0.0 Source

Creates a new MutableList from the specified elements.

Signature

declare function make<A>(...elements: readonly Array<A>): MutableList<A>

Getters

isEmpty

Added in v2.0.0 Source

Returns true if the list contains zero elements, false, otherwise.

Signature

declare function isEmpty<A>(self: MutableList<A>): boolean

length

Added in v2.0.0 Source

Returns the length of the list.

Signature

declare function length<A>(self: MutableList<A>): number

tail

Added in v2.0.0 Source

Returns the last element of the list, if it exists.

Signature

declare function tail<A>(self: MutableList<A>): A | undefined

Model

MutableList interface

Added in v2.0.0 Source

Signature

interface MutableList<out A> extends Iterable<A>, Pipeable, Inspectable {
readonly [TypeId]: typeof TypeId;
}

Other

pop

Added in v0.0.1 Source

Removes the last value from the list and returns it, if it exists.

Signature

declare function pop<A>(self: MutableList<A>): A | undefined

reset

Added in v2.0.0 Source

Removes all elements from the doubly-linked list.

Signature

declare function reset<A>(self: MutableList<A>): MutableList<A>

shift

Added in v0.0.1 Source

Removes the first value from the list and returns it, if it exists.

Signature

declare function shift<A>(self: MutableList<A>): A | undefined

Symbol

TypeId type

Added in v2.0.0 Source

Signature

type TypeId = typeof TypeId

Traversing

forEach

Added in v2.0.0 Source

Executes the specified function f for each element in the list.

Signature

declare const forEach: {
<A>(f: (element: A) => void): (self: MutableList<A>) => void;
<A>(self: MutableList<A>, f: (element: A) => void): void;
}