Class JSHashMap

java.lang.Object
com.oracle.truffle.js.runtime.util.JSHashMap

public final class JSHashMap extends Object
ES6-compliant hash map implementation. A single node links each entry into both a hash bucket and the insertion-order list. Removed nodes retain their order links so that live cursors can recover from removal and clear operations.
  • Constructor Details

    • JSHashMap

      public JSHashMap()
  • Method Details

    • size

      public int size()
    • put

      public void put(Object key, int hashCode, Object value)
      Insert new entry, if key does not already exist, otherwise update the existing entry's value.
    • putIfAbsent

      public Object putIfAbsent(Object key, int hashCode, Object value)
      Inserts a new entry if the key is absent.
      Returns:
      the existing value, or null if the new entry was inserted
    • getOrInsert

      public Object getOrInsert(Object key, int hashCode, Object value)
    • get

      public Object get(Object key, int hashCode)
    • getOrDefault

      public Object getOrDefault(Object key, int hashCode, Object defaultValue)
    • has

      public boolean has(Object key, int hashCode)
    • remove

      public boolean remove(Object key, int hashCode)
    • clear

      public void clear()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getEntries

      public JSHashMap.Cursor getEntries()
    • copy

      public JSHashMap copy()