SmartArrayNoDuplicate<T>

Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations. The data in this array can only be present once

Type parameters

  • T

Hierarchy

Implements

Index

Constructors

constructor

Find examples in Playground

Properties

data

Find examples in Playground
data: Array<T>

The full set of data from the array.

length

Find examples in Playground
length: number

The active length of the array.

Methods

concat

Find examples in Playground
  • concat(array: any): void
  • Concats the active data with a given array.

    Parameters

    • array: any

      defines the data to concatenate with.

    Returns void

concatWithNoDuplicate

Find examples in Playground
  • concatWithNoDuplicate(array: any): void
  • Concats the active data with a given array. This ensures no dupplicate will be present in the result.

    Parameters

    • array: any

      defines the data to concatenate with.

    Returns void

contains

Find examples in Playground
  • contains(value: T): boolean
  • Returns whether an element is part of the active data.

    Parameters

    • value: T

      defines the value to look for

    Returns boolean

    true if found in the active data otherwise false

dispose

Find examples in Playground
  • dispose(): void
  • Releases all the data from the array as well as the array.

    Returns void

forEach

Find examples in Playground
  • forEach(func: function): void
  • Iterates over the active data and apply the lambda to them.

    Parameters

    • func: function

      defines the action to apply on each value.

        • (content: T): void
        • Parameters

          • content: T

          Returns void

    Returns void

indexOf

Find examples in Playground
  • indexOf(value: T): number
  • Returns the position of a value in the active data.

    Parameters

    • value: T

      defines the value to find the index for

    Returns number

    the index if found in the active data otherwise -1

push

Find examples in Playground
  • push(value: T): void
  • Pushes a value at the end of the active data. THIS DOES NOT PREVENT DUPPLICATE DATA

    Parameters

    • value: T

      defines the object to push in the array.

    Returns void

pushNoDuplicate

Find examples in Playground
  • pushNoDuplicate(value: T): boolean
  • Pushes a value at the end of the active data. If the data is already present, it won t be added again

    Parameters

    • value: T

      defines the object to push in the array.

    Returns boolean

    true if added false if it was already present

reset

Find examples in Playground
  • reset(): void
  • Resets the active data to an empty array.

    Returns void

sort

Find examples in Playground
  • sort(compareFn: function): void
  • Sorts the full sets of data.

    Parameters

    • compareFn: function

      defines the comparison function to apply.

        • (a: T, b: T): number
        • Parameters

          • a: T
          • b: T

          Returns number

    Returns void

Generated using TypeDoc