Module openj9.dtfj

Class IntegerMap

  • All Implemented Interfaces:
    Serializable

    public final class IntegerMap
    extends AbstractHashMap
    This is a simple class to map one integer to another but without the overhead of using a Hashtable. There is one limitation at present which is that the value of -1 can't be used since this is currently used to indicate value not found.
    See Also:
    Serialized Form
    • Constructor Detail

      • IntegerMap

        public IntegerMap()
    • Method Detail

      • get

        public long get​(long key)
        Returns the value mapped by the given key.
        Returns:
        the value or -1 if it cannot be found
      • put

        public void put​(long key,
                        long value)
        Add the key/value pair to the map. The value must not be -1.
      • remove

        public long remove​(long key)
        Remove the key from the map and return the old value.
      • memoryUsage

        public int memoryUsage()
      • main

        public static void main​(String[] args)
        Run some basic tests on this class.