Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Map<T>

A collection with a non-indexed key.
Useful to store a set of values of the same type.

Type parameters

  • T

Hierarchy

Index

Constructors

Methods

Constructors

constructor

  • new Map(): Map

Methods

get

  • get(key: string): T | null
  • Get an value from the map.

    Parameters

    • key: string

      The name of the value to get.

    Returns T | null

    The value, or null if the value does not exist in the map.

getAll

  • getAll(): T[]
  • Get an array containing all the values of the map.

    Returns T[]

remove

  • remove(key: string): boolean
  • Remove an value from the map.

    Parameters

    • key: string

      The value's name to be removed from the map.

    Returns boolean

    True if the value was removed, false if the value was not found.

removeAll

  • removeAll(): void
  • Clear the map by removing all the keys and values that it stores.

    Returns void

set

  • set(key: string, value: T): void
  • Add or update an value.

    Parameters

    • key: string

      The name of the value to set.

    • value: T

      The value to set for this value.

    Returns void

Generated using TypeDoc