Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

MutableList

15 exports Since v0.0.1 Source

Concatenating

Since v2.0.0

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>;
}
Since v2.0.0

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

Since v2.0.0

Creates an empty MutableList.

Signature

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

Creates a new MutableList from an iterable collection of values.

Signature

declare function fromIterable<A>(iterable: Iterable<A>): MutableList<A>
Since v2.0.0

Creates a new MutableList from the specified elements.

Signature

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

Getters

Since v2.0.0

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

Signature

declare function isEmpty<A>(self: MutableList<A>): boolean
Since v2.0.0

Returns the length of the list.

Signature

declare function length<A>(self: MutableList<A>): number
Since v2.0.0

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

Signature

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

Model

MutableList

interface
Since v2.0.0

Signature

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

Other

Since v0.0.1

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

Signature

declare function pop<A>(self: MutableList<A>): A | undefined
Since v2.0.0

Removes all elements from the doubly-linked list.

Signature

declare function reset<A>(self: MutableList<A>): MutableList<A>
Since v0.0.1

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

Signature

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

Symbol

Since v2.0.0

Signature

type TypeId = typeof TypeId

Traversing

Since v2.0.0

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;
}