Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IObservableList<T>

A list which can be observed for changes.

Type parameters

  • T

Hierarchy

Implemented by

Index

Properties

Readonly changed

changed: ISignal<IObservableList<T>, IChangedArgs<T>>

A signal emitted when the list has changed.

Readonly isDisposed

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

length

length: number

The length of the list.

Notes

This is a read-only property.

Readonly type

type: "List"

The type of this object.

Methods

clear

  • clear(): void
  • Remove all values from the list.

    Complexity

    Linear.

    Iterator Validity

    All current iterators are invalidated.

    Returns void

dispose

  • dispose(): void
  • Dispose of the resources held by the object.

    Notes

    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    Undefined Behavior

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    Returns void

get

  • get(index: number): T
  • Get the value at the specified index.

    Parameters

    • index: number

      The positive integer index of interest.

    Returns T

    The value at the specified index.

    Undefined Behavior

    An index which is non-integral or out of range.

insert

  • insert(index: number, value: T): void
  • Insert a value into the list at a specific index.

    Parameters

    Returns void

insertAll

  • insertAll(index: number, values: IterableOrArrayLike<T>): void
  • Insert a set of items into the list at the specified index.

    Parameters

    Returns void

iter

  • iter(): IIterator<T>
  • Create an iterator over the values in the list.

    Returns IIterator<T>

    A new iterator starting at the front of the list.

    Complexity

    Constant.

    Iterator Validity

    No changes.

move

  • move(fromIndex: number, toIndex: number): void
  • Move a value from one index to another.

    parm

    fromIndex - The index of the element to move.

    Parameters

    • fromIndex: number
    • toIndex: number

      The index to move the element to.

      Complexity

      Constant.

      Iterator Validity

      Iterators pointing at the lesser of the fromIndex and the toIndex and beyond are invalidated.

      Undefined Behavior

      A fromIndex or a toIndex which is non-integral.

    Returns void

push

  • push(value: T): number
  • Add a value to the back of the list.

    Parameters

    • value: T

      The value to add to the back of the list.

    Returns number

    The new length of the list.

    Complexity

    Constant.

    Iterator Validity

    No changes.

pushAll

  • pushAll(values: IterableOrArrayLike<T>): number
  • Push a set of values to the back of the list.

    Parameters

    • values: IterableOrArrayLike<T>

      An iterable or array-like set of values to add.

    Returns number

    The new length of the list.

    Complexity

    Linear.

    Iterator Validity

    No changes.

remove

  • remove(index: number): T
  • Remove and return the value at a specific index.

    Parameters

    • index: number

      The index of the value of interest.

    Returns T

    The value at the specified index, or undefined if the index is out of range.

    Complexity

    Constant.

    Iterator Validity

    Iterators pointing at the removed value and beyond are invalidated.

    Undefined Behavior

    An index which is non-integral.

removeRange

  • removeRange(startIndex: number, endIndex: number): number
  • Remove a range of items from the list.

    Parameters

    • startIndex: number

      The start index of the range to remove (inclusive).

    • endIndex: number

      The end index of the range to remove (exclusive).

    Returns number

    The new length of the list.

    Complexity

    Linear.

    Iterator Validity

    Iterators pointing to the first removed value and beyond are invalid.

    Undefined Behavior

    A startIndex or endIndex which is non-integral.

removeValue

  • removeValue(value: T): number
  • Remove the first occurrence of a value from the list.

    Parameters

    • value: T

      The value of interest.

    Returns number

    The index of the removed value, or -1 if the value is not contained in the list.

    Complexity

    Linear.

    Iterator Validity

    Iterators pointing at the removed value and beyond are invalidated.

set

  • set(index: number, value: T): void
  • Set the value at the specified index.

    Parameters

    Returns void

Generated using TypeDoc