Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CachedArray<T>

Cached array is a data structure for objects cache, it's designed for persistent data. Its content array length will keep grow.

Type parameters

  • T

Hierarchy

  • CachedArray

Index

Constructors

constructor

  • newCachedArray(length: number, compareFn?: undefined | ((a: T, b: T) => number)): CachedArray

Properties

Private _compareFn

_compareFn: any

array

array: T[]

The array which stores actual content

length

length: number = 0

The actual count of data object

Methods

clear

  • clear(): void

concat

  • concat(array: T[]): void
  • Add all elements of a given array to the end of the current array

    Parameters

    • array: T[]

      The given array to be appended

    Returns void

destroy

  • destroy(): void

fastRemove

  • fastRemove(idx: number): void
  • Delete the element at the specified location and move the last element to that location.

    Parameters

    • idx: number

      The index of the element to be deleted

    Returns void

get

  • get(idx: number): T
  • Get the element at the specified index of the array

    Parameters

    • idx: number

      The index of the requested element

    Returns T

    The element at given index

indexOf

  • indexOf(val: T): number

pop

  • pop(): T | undefined

push

  • push(item: T): void

sort

  • sort(): void

Generated using TypeDoc