Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PriorityMap<T>

Used for ordering a list of items by "priority". Higher priorities come before lower priorities.

Type parameters

  • T

Hierarchy

  • PriorityMap

Index

Accessors

size

  • get size(): number
  • Returns number

Methods

delete

  • delete(priority: number): boolean
  • Parameters

    • priority: number

    Returns boolean

getInternalMap

  • getInternalMap(): {}
  • Returns {}

getOrDefault

  • getOrDefault(priority: number): T | undefined
  • getOrDefault(priority: number, orDefault: (priority: number) => T, assign?: undefined | false | true): T
  • getOrDefault(priority: number, orDefault?: undefined | ((priority: number) => T), assign?: undefined | false | true): T | undefined
  • Parameters

    • priority: number

    Returns T | undefined

  • Parameters

    • priority: number
    • orDefault: (priority: number) => T
        • (priority: number): T
        • Parameters

          • priority: number

          Returns T

    • Optional assign: undefined | false | true

    Returns T

  • Parameters

    • priority: number
    • Optional orDefault: undefined | ((priority: number) => T)
    • Optional assign: undefined | false | true

    Returns T | undefined

retainWhere

  • retainWhere(predicate: (val: T, key: number) => any): boolean
  • retainWhere(key: number, predicate: (val: T, key: number) => any): boolean
  • Retains the entries from this set that match the given predicate function, any other entries will be deleted.

    Parameters

    • predicate: (val: T, key: number) => any

      A predicate that takes a key and a value, and returns a value which will be checked for truthiness.

        • (val: T, key: number): any
        • Parameters

          • val: T
          • key: number

          Returns any

    Returns boolean

    whether any entries remain.

  • If this map contains the given key, checks whether the entry matches the given predicate. If it does, it is kept. If not, it's deleted.

    Parameters

    • key: number
    • predicate: (val: T, key: number) => any

      A predicate that takes a key and a value, and returns a value which will be checked for truthiness.

        • (val: T, key: number): any
        • Parameters

          • val: T
          • key: number

          Returns any

    Returns boolean

    whether any entries remain in this map.

stream

  • Returns an iterator of the items in this list.

    Parameters

    Returns Stream<T>

Static streamAll

  • streamAll<T>(...lists: Array<PriorityMap<T>>): Stream<T>
  • Type parameters

    • T: Iterable<any>

    Parameters

    Returns Stream<T>

Generated using TypeDoc