Interface JsWeakMap<K,V>

Type Parameters:
K - the key type
V - the value type
All Known Implementing Classes:
JreJsWeakMap

@JsType(isNative=true) public interface JsWeakMap<K,V>
Native JS WeakMap interface with an alternative implementation for JRE usage. Use JsCollections.weakMap() to create an appropriate instance.
Since:
1.0
Author:
Vaadin Ltd
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    delete(K key)
    Removes the mapping for a given key.
    get(K key)
    Gets the value mapped for the given key.
    boolean
    has(K key)
    Checks whether this map contains a mapping for the given key.
    set(K key, V value)
    Sets a value in this map, overwriting any previous mapping if present.
  • Method Details

    • set

      JsWeakMap<K,V> set(K key, V value)
      Sets a value in this map, overwriting any previous mapping if present.
      Parameters:
      key - the key to set
      value - the value to set
      Returns:
      this map, for chaining.
    • get

      V get(K key)
      Gets the value mapped for the given key. Returns null if there is no mapping, if the key is explicitly mapped to null or if the key has been garbage collected.
      Parameters:
      key - the key to get a value for
      Returns:
      the value corresponding to the given key; or null there is no mapping.
    • has

      boolean has(K key)
      Checks whether this map contains a mapping for the given key.
      Parameters:
      key - the key to check
      Returns:
      true if there is a mapping for the key; false if there is no mapping
    • delete

      boolean delete(K key)
      Removes the mapping for a given key.
      Parameters:
      key - the key for which to remove the mapping
      Returns:
      true if the map contained a mapping for the given key prior to calling this method; false if no mapping was present