Class Collection<K, V>

支持Map与Array功能的集合对象

Type Parameters

  • K

  • V

Hierarchy

  • Map<K, V>
    • Collection

Constructors

  • Type Parameters

    • K

    • V

    Parameters

    • Optional entries: null | readonly (readonly [K, V])[]

    Returns Collection<K, V>

  • Type Parameters

    • K

    • V

    Parameters

    • Optional iterable: null | Iterable<readonly [K, V]>

    Returns Collection<K, V>

Properties

[toStringTag]: string
_array: V[] = []
size: number

Returns

the number of elements in the Map.

[species]: MapConstructor

Accessors

  • get array(): V[]
  • 获取数组对象

    Returns V[]

Methods

  • Returns an iterable of entries in the map.

    Returns IterableIterator<[K, V]>

  • Returns void

  • 删除值

    Parameters

    • key: K

      关键字

    Returns boolean

  • Returns an iterable of key, value pairs for every entry in the map.

    Returns IterableIterator<[K, V]>

  • Executes a provided function once per each key/value pair in the Map, in insertion order.

    Parameters

    • callbackfn: ((value: V, key: K, map: Map<K, V>) => void)
        • (value: V, key: K, map: Map<K, V>): void
        • Parameters

          • value: V
          • key: K
          • map: Map<K, V>

          Returns void

    • Optional thisArg: any

    Returns void

  • Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.

    Returns

    Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.

    Parameters

    • key: K

    Returns undefined | V

  • Returns

    boolean indicating whether an element with the specified key exists or not.

    Parameters

    • key: K

    Returns boolean

  • Returns an iterable of keys in the map

    Returns IterableIterator<K>

  • 设置值

    Parameters

    • key: K

      关键字

    • value: V

      数据值

    Returns Collection<K, V>

  • Returns an iterable of values in the map

    Returns IterableIterator<V>

Generated using TypeDoc