Class HashMap<K, V>

Type Parameters

  • K

  • V

Hierarchy

Constructors

Methods

  • Description

    Iterate over all elements in the container.

    Parameters

    • callback: ((element: [K, V], index: number) => void)

      Callback function like Array.forEach.

        • (element: [K, V], index: number): void
        • Parameters

          • element: [K, V]
          • index: number

          Returns void

    Returns void

  • Description

    Get the value of the element which has the specified key.

    Parameters

    • key: K

      The key you want to get.

    Returns undefined | V

  • Description

    Insert a new key-value pair to hash map or set value by key.

    Example

    HashMap.setElement(1, 2); // insert a key-value pair [1, 2]
    

    Parameters

    • key: K

      The key you want to insert.

    • value: V

      The value you want to insert.

    Returns void

Generated using TypeDoc