Class SortedMap<K, V>

Type Parameters

  • K

  • V

Hierarchy

  • Map<K, V>
    • SortedMap

Implements

  • IterableIterator<[K, V]>

Constructors

  • Type Parameters

    • K

    • V

    Returns SortedMap<K, V>

  • Type Parameters

    • K

    • V

    Parameters

    • Optional entries: Iterable<readonly [K, V]>
    • Optional comparator: ((a, b, c?, d?) => number)
        • (a, b, c?, d?): number
        • Parameters

          • a: K
          • b: K
          • Optional c: V
          • Optional d: V

          Returns number

    Returns SortedMap<K, V>

Properties

[toStringTag]: string
size: number

Returns

the number of elements in the Map.

[species]: MapConstructor

Methods

  • Returns an iterable of entries in the map.

    Returns IterableIterator<[K, V]>

    an iterable of entries in the map.

  • The clear() method removes all elements from a Map object.

    Returns void

  • The delete() method removes the specified element from a Map object by key.

    Parameters

    • key: K

      The key of the element to remove from the Map object.

    Returns boolean

    true if an element in the Map object existed and has been removed, or false if the element does not exist.

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

    Returns IterableIterator<[K, V]>

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

  • Returns the first (lowest) key currently in this map.

    Returns K

    the first (lowest) key currently in this map

  • The forEach() method executes a provided function once per each key/value pair in the Map object, in insertion order.

    Parameters

    • callbackFn: ((value, key, map) => void)

      Function to execute for each entry in the map.

        • (value, key, map): void
        • Parameters

          Returns void

    • Optional thisArg: any

      Value to use as this when executing callback.

    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.

    Parameters

    • key: K

    Returns V

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

  • Parameters

    • key: K

    Returns boolean

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

  • Returns a view of the portion of this map whose keys are strictly less than toKey.

    Parameters

    • toKey: K

      high endpoint (exclusive) of the keys in the returned map

    Returns SortedMap<K, V>

    a view of the portion of this map whose keys are strictly less than toKey

  • Returns an iterable of keys in the map

    Returns IterableIterator<K>

    an iterable of keys in the map

  • Returns the last (highest) key currently in this map.

    Returns K

    the last (highest) key currently in this map

  • Parameters

    • Optional value: any

    Returns IteratorResult<[K, V], any>

  • Parameters

    • Optional value: any

    Returns IteratorResult<[K, V], any>

  • The set() method adds or updates an element with a specified key and a value to a Map object.

    Parameters

    • key: K

      The key of the element to add to the Map object.

    • value: V

      The value of the element to add to the Map object.

    Returns SortedMap<K, V>

    The Map object.

  • If the specified key is not already associated with a value associates it with the given value and returns that value, else returns the current value.

    Parameters

    • key: K

      key with which the specified value is to be associated

    • value: V

      value to be associated with the specified key

    Returns V

    the previous value associated with the specified key, or the specified value if there was no mapping for the key.

  • Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive.

    Parameters

    • fromKey: K

      low endpoint (inclusive) of the keys in the returned map

    • toKey: K

      high endpoint (exclusive) of the keys in the returned map

    Returns SortedMap<K, V>

    a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive

  • Returns a view of the portion of this map whose keys are greater than or equal to fromKey.

    Parameters

    • fromKey: K

      low endpoint (inclusive) of the keys in the returned map

    Returns SortedMap<K, V>

    a view of the portion of this map whose keys are greater than or equal to fromKey

  • Parameters

    • Optional e: any

    Returns IteratorResult<[K, V], any>

  • Returns an iterable of values in the map.

    Returns IterableIterator<V>

    an iterable of values in the map.