• Public
  • Public/Protected
  • All

Class CollectionUtil

This class implements static methods to perform useful operations on lists, dictionaries, ...


  • CollectionUtil



Static binarySearch

  • binarySearch<T>(array: T[], element: T, cmp: (elem1: T, elem2: T) => number, startIndex?: number, endIndex?: number): number
  • Type parameters

    • T


    • array: T[]
    • element: T
    • cmp: (elem1: T, elem2: T) => number
        • (elem1: T, elem2: T): number
        • Parameters

          • elem1: T
          • elem2: T

          Returns number

    • Default value startIndex: number = 0
    • Default value endIndex: number = array.length - 1

    Returns number

Static contains2

  • contains2(array: any[], object: any): boolean

Static getLastElement

  • getLastElement<T>(array: T[]): T

Static last

  • last(array: any[]): any

Static removeDictElementIfTrue

  • removeDictElementIfTrue<S, T, V>(thisPointer: S, dict: Dictionary<T, V>, iterationFunction: (thisPointer: S, key: T, value: V) => boolean): void
  • Iterates through a dictionary and calls iterationFunction. If iterationFunction returns true the key gets stored. all stored key will finally be removed from the dictionary.

    Type parameters

    • S

    • T

    • V


    • thisPointer: S
    • dict: Dictionary<T, V>
    • iterationFunction: (thisPointer: S, key: T, value: V) => boolean
        • (thisPointer: S, key: T, value: V): boolean
        • Parameters

          • thisPointer: S
          • key: T
          • value: V

          Returns boolean

    Returns void

Generated using TypeDoc