Class HashContainer<K, V>Abstract

Type Parameters

  • K

  • V

Hierarchy

Accessors

  • get length(): number
  • Returns

    The size of the container.

    Example

    const container = new Vector([1, 2]);
    console.log(container.length); // 2

    Returns number

Methods

  • Description

    Iterate over all elements in the container.

    Example

    container.forEach((element, index) => console.log(element, index));
    

    Parameters

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

      Callback function like Array.forEach.

        • (element: K | [K, V], index: number, container: Container<K | [K, V]>): void
        • Parameters

          • element: K | [K, V]
          • index: number
          • container: Container<K | [K, V]>

          Returns void

    Returns void

  • Description

    Remove the element of the specified key.

    Returns

    Whether erase successfully.

    Parameters

    • key: K

      The key you want to remove.

    • Optional isObject: boolean

      Tell us if the type of inserted key is object to improve efficiency.
      If a undefined value is passed in, the type will be automatically judged.

    Returns boolean

  • Description

    Removes the element at the specified position.

    Returns

    The container length after erasing.

    Example

    container.eraseElementByPos(-1); // throw a RangeError
    

    Parameters

    • pos: number

      The element's position you want to remove.

    Returns number

Properties

HASH_TAG: symbol = ...

Description

Unique symbol used to tag object.

Generated using TypeDoc