Class UintMap

java.lang.Object
org.mozilla.javascript.UintMap
All Implemented Interfaces:
Serializable

public class UintMap extends Object implements Serializable
Map to associate non-negative integers to objects or integers. The map does not synchronize any of its operation, so either use it from a single thread or do own synchronization or perform all mutation operations on one thread before passing the map to others.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    UintMap(int initialCapacity)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    int
    getExistingInt(int key)
    Get integer value assigned with key.
    int
    getInt(int key, int defaultValue)
    Get integer value assigned with key.
    int[]
    Return array of present keys
    getObject(int key)
    Get object value assigned with key.
    boolean
    has(int key)
     
    boolean
     
    void
    put(int key, int value)
    Set int value of the key.
    void
    put(int key, Object value)
    Set object value of the key.
    void
    remove(int key)
     
    int
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • UintMap

      public UintMap()
    • UintMap

      public UintMap(int initialCapacity)
  • Method Details

    • isEmpty

      public boolean isEmpty()
    • size

      public int size()
    • has

      public boolean has(int key)
    • getObject

      public Object getObject(int key)
      Get object value assigned with key.
      Returns:
      key object value or null if key is absent
    • getInt

      public int getInt(int key, int defaultValue)
      Get integer value assigned with key.
      Returns:
      key integer value or defaultValue if key is absent
    • getExistingInt

      public int getExistingInt(int key)
      Get integer value assigned with key.
      Returns:
      key integer value or defaultValue if key does not exist or does not have int value
      Throws:
      RuntimeException - if key does not exist
    • put

      public void put(int key, Object value)
      Set object value of the key. If key does not exist, also set its int value to 0.
    • put

      public void put(int key, int value)
      Set int value of the key. If key does not exist, also set its object value to null.
    • remove

      public void remove(int key)
    • clear

      public void clear()
    • getKeys

      public int[] getKeys()
      Return array of present keys