Class ArrayUtilities

Index

Methods

Methods

public static all(array: Array<T>, func: (v: T) => boolean): boolean

Parameters

  • array: Array<T>
  • func: (v: T) => boolean

Returns

boolean

public static any(array: Array<T>, func: (v: T) => boolean): boolean

Parameters

  • array: Array<T>
  • func: (v: T) => boolean

Returns

boolean

public static binarySearch(array: Array<number>, value: number): number

Parameters

  • array: Array<number>
  • value: number

Returns

number

public static contains(array: Array<T>, value: T): boolean

Parameters

  • array: Array<T>
  • value: T

Returns

boolean

public static copy(sourceArray: Array<T>, sourceIndex: number, destinationArray: Array<T>, destinationIndex: number, length: number)

Parameters

  • sourceArray: Array<T>
  • sourceIndex: number
  • destinationArray: Array<T>
  • destinationIndex: number
  • length: number

public static createArray(length: number, defaultValue: any): Array<T>

Parameters

  • length: number
  • defaultValue: any

Returns

Array<T>

public static distinct(array: Array<T>, equalsFn?: (a: T, b: T) => boolean): Array<T>

Parameters

  • array: Array<T>
  • equalsFn?: (a: T, b: T) => boolean optional

Returns

Array<T>

public static first(array: Array<T>, func?: (v: T, index: number) => boolean): T

Parameters

  • array: Array<T>
  • func?: (v: T, index: number) => boolean optional

Returns

T

public static firstOrDefault(array: Array<T>, func: (v: T, index: number) => boolean): T

Parameters

  • array: Array<T>
  • func: (v: T, index: number) => boolean

Returns

T

public static groupBy(array: Array<T>, func: (v: T) => string): any

Parameters

  • array: Array<T>
  • func: (v: T) => string

Returns

any

public static grow(array: Array<T>, length: number, defaultValue: T)

Parameters

  • array: Array<T>
  • length: number
  • defaultValue: T

public static indexOf(array: Array<T>, predicate: (v: T) => boolean): number

Parameters

  • array: Array<T>
  • predicate: (v: T) => boolean

Returns

number

public static isArray(value: any): boolean

Parameters

  • value: any

Returns

boolean

public static last(array: Array<T>): T

Parameters

  • array: Array<T>

Returns

T

public static lastOrDefault(array: Array<T>, predicate: (v: T, index: number) => boolean): T

Parameters

  • array: Array<T>
  • predicate: (v: T, index: number) => boolean

Returns

T

public static max(array: Array<T>, func: (v: T) => number): number

Parameters

  • array: Array<T>
  • func: (v: T) => number

Returns

number

public static min(array: Array<T>, func: (v: T) => number): number

Parameters

  • array: Array<T>
  • func: (v: T) => number

Returns

number

public static select(values: Array<T>, func: (v: T) => S): Array<S>

Parameters

  • values: Array<T>
  • func: (v: T) => S

Returns

Array<S>

public static sequenceEquals(array1: Array<T>, array2: Array<T>, equals: (v1: T, v2: T) => boolean): boolean

Parameters

  • array1: Array<T>
  • array2: Array<T>
  • equals: (v1: T, v2: T) => boolean

Returns

boolean

public static sum(array: Array<T>, func: (v: T) => number): number

Parameters

  • array: Array<T>
  • func: (v: T) => number

Returns

number

public static where(values: Array<T>, func: (v: T) => boolean): Array<T>

Parameters

  • values: Array<T>
  • func: (v: T) => boolean

Returns

Array<T>