Class FixedSizeArray<T>

A class that represents a fixed-size array that removes the oldest item when a new item is added and the size exceeds the maximum.

Type Parameters

  • T

Hierarchy

  • FixedSizeArray

Constructors

Properties

Methods

Constructors

  • Creates a new instance of the FixedSizeArray

    Type Parameters

    • T

    Parameters

    • maxSize: number

      The maximum size of the array

    Returns FixedSizeArray<T>

Properties

data: T[]

The data stored in the array

maxSize: number

The maximum size of the array

Methods

  • Adds a new item to the array

    Parameters

    • item: T

      The item to be added

    Returns void

  • Iterates over the items in the array and performs a callback function on each item

    Parameters

    • callback: ((item: T, index: number, array: T[]) => void)

      A callback function to be performed on each item in the array

        • (item: T, index: number, array: T[]): void
        • Parameters

          • item: T
          • index: number
          • array: T[]

          Returns void

    Returns void

  • Returns the data stored in the array

    Returns

    The data stored in the array

    Returns T[]

Generated using TypeDoc