TopLevel
Class WeakMap
WeakMap
The WeakMap is map whose entries are subject to garbage collection if there are no more references to the keys.
Keys must be objects (no primitives). Elements can't be iterated.
API Versioned:
From version 21.2.
Properties
size
:
Number
Number of key/value pairs stored in this map.
Constructor Summary
WeakMap()
Creates an empty map.
Method Summary
clear()
:
void
Removes all key/value pairs from this map.
Methods inherited from class
Object
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
Constructor Detail
WeakMap
public WeakMap(values
:
Iterable)
If the passed value is null or undefined then an empty map is constructed. Else an iterator object is expected
that produces a two-element array-like object whose first element is a value that will be used as a Map key and
whose second element is the value to associate with that key.
Parameters:
values
-
The initial map values
Method Detail
delete
delete(key
:
Object)
:
boolean
Removes the entry for the given key.
Parameters:
key
-
The key of the key/value pair to be removed from the map.
Returns:
true
if the map contained an entry for the passed key that was removed. Else false
is returned.
get
Returns the value associated with the given key.
Parameters:
key
-
The key to look for.
Returns:
The value associated with the given key if an entry with the key exists else
undefined
is returned.
has
has(key
:
Object)
:
boolean
Returns if this map has value associated with the given key.
Parameters:
key
-
The key to look for.
Returns:
true
if an entry with the key exists else false
is returned.
© Copyright 2000-2024, salesforce.com inc. All rights reserved. Various trademarks held by their respective owners.