Class IntMap


  • public class IntMap
    extends java.lang.Object
    The IntMap provides a simple hashmap from keys to integers. The API is an abbreviation of the HashMap collection API.

    The convenience of IntMap is avoiding all the silly wrapping of integers.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int NULL
      Encoding of a null entry.
      static int[] PRIMES  
    • Constructor Summary

      Constructors 
      Constructor Description
      IntMap()
      Create a new IntMap.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clear the hashmap.
      int get​(java.lang.Object key)
      Puts a new value in the property table with the appropriate flags
      static int getBiggestPrime​(int value)  
      protected int hashCode​(java.lang.Object value)  
      int put​(java.lang.Object key, int value, boolean isReplace)
      Puts a new value in the property table with the appropriate flags
      int size()
      Returns the current number of entries in the map.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • NULL

        public static final int NULL
        Encoding of a null entry. Since NULL is equal to Integer.MIN_VALUE, it's impossible to distinguish between the two.
        See Also:
        Constant Field Values
      • PRIMES

        public static final int[] PRIMES
    • Constructor Detail

      • IntMap

        public IntMap()
        Create a new IntMap. Default size is 16.
    • Method Detail

      • clear

        public void clear()
        Clear the hashmap.
      • size

        public final int size()
        Returns the current number of entries in the map.
      • get

        public final int get​(java.lang.Object key)
        Puts a new value in the property table with the appropriate flags
      • put

        public final int put​(java.lang.Object key,
                             int value,
                             boolean isReplace)
        Puts a new value in the property table with the appropriate flags
      • hashCode

        protected int hashCode​(java.lang.Object value)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getBiggestPrime

        public static int getBiggestPrime​(int value)