Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Collection<T>

Excalibur's dynamically resizing collection

Type parameters

  • T

Hierarchy

  • Collection

Index

Constructors

constructor

  • new Collection(initialSize?: number): Collection

Properties

Static DefaultSize

DefaultSize: number = 200

Default collection size

Methods

clear

  • clear(): void

count

  • count(): number

elementAt

  • elementAt(index: number): T
  • Returns an element at a specific index

    Parameters

    • index: number

      Index of element to retrieve

    Returns T

forEach

  • forEach(func: function): void
  • Iterate over every element in the collection

    Parameters

    • func: function

      Callback to call for each element passing a reference to the element and its index, returned values are ignored

        • (element: T, index: number): any
        • Parameters

          • element: T
          • index: number

          Returns any

    Returns void

insert

  • insert(index: number, value: T): T
  • Inserts an element at a specific index

    Parameters

    • index: number

      Index to insert the element

    • value: T

      Element to insert

    Returns T

internalSize

  • internalSize(): number

map

  • map(func: function): void
  • Mutate every element in the collection

    Parameters

    • func: function

      Callback to call for each element passing a reference to the element and its index, any values returned mutate the collection

        • (element: T, index: number): any
        • Parameters

          • element: T
          • index: number

          Returns any

    Returns void

pop

  • pop(): T

push

  • push(element: T): T

remove

  • remove(index: number): T
  • Removes an element at a specific index

    Parameters

    • index: number

      Index of element to remove

    Returns T

removeElement

  • removeElement(element: T): void

toArray

  • toArray(): T[]