Skip to main content Link Search Menu Expand Document (external link)

MutableList overview

Added in v2.0.0


Table of contents


concatenating

append

Appends the specified element to the end of the MutableList.

Signature

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

Added in v2.0.0

prepend

Prepends the specified value to the beginning of the list.

Signature

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

Added in v2.0.0

constructors

empty

Creates an empty MutableList.

Signature

export declare const empty: <A>() => MutableList<A>

Added in v2.0.0

fromIterable

Creates a new MutableList from an iterable collection of values.

Signature

export declare const fromIterable: <A>(iterable: Iterable<A>) => MutableList<A>

Added in v2.0.0

make

Creates a new MutableList from the specified elements.

Signature

export declare const make: <A>(...elements: ReadonlyArray<A>) => MutableList<A>

Added in v2.0.0

getters

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

Signature

export declare const head: <A>(self: MutableList<A>) => A | undefined

Added in v2.0.0

isEmpty

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

Signature

export declare const isEmpty: <A>(self: MutableList<A>) => boolean

Added in v2.0.0

length

Returns the length of the list.

Signature

export declare const length: <A>(self: MutableList<A>) => number

Added in v2.0.0

tail

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

Signature

export declare const tail: <A>(self: MutableList<A>) => A | undefined

Added in v2.0.0

model

MutableList (interface)

Signature

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

  /** @internal */
  head: LinkedListNode<A> | undefined
  /** @internal */
  tail: LinkedListNode<A> | undefined
}

Added in v2.0.0

symbol

TypeId (type alias)

Signature

export type TypeId = typeof TypeId

Added in v2.0.0

traversing

forEach

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

Signature

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

Added in v2.0.0

utils

pop

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

Signature

export declare const pop: <A>(self: MutableList<A>) => A | undefined

Added in v0.0.1

reset

Removes all elements from the doubly-linked list.

Signature

export declare const reset: <A>(self: MutableList<A>) => MutableList<A>

Added in v2.0.0

shift

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

Signature

export declare const shift: <A>(self: MutableList<A>) => A | undefined

Added in v0.0.1