Class HashMapHelper


  • public final class HashMapHelper
    extends java.lang.Object
    Common HashMap methods taken from FastUtil implementation
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int arraySize​(int expected, float f)
      Returns the least power of two smaller than or equal to 230 and larger than or equal to Math.ceil( expected / f ).
      static long nextPowerOfTwo​(long length)
      Return the least power of two greater than or equal to the specified value.
      static int phiMix​(int x)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • arraySize

        public static int arraySize​(int expected,
                                    float f)
        Returns the least power of two smaller than or equal to 230 and larger than or equal to Math.ceil( expected / f ).
        Parameters:
        expected - the expected number of elements in a hash table.
        f - the load factor.
        Returns:
        the minimum possible size for a backing array.
        Throws:
        java.lang.IllegalArgumentException - if the necessary size is larger than 230.
      • nextPowerOfTwo

        public static long nextPowerOfTwo​(long length)
        Return the least power of two greater than or equal to the specified value.

        Note that this function will return 1 when the argument is 0.

        Parameters:
        length - a long integer smaller than or equal to 262.
        Returns:
        the least power of two greater than or equal to the specified value.
      • phiMix

        public static int phiMix​(int x)