it.unimi.dsi.fastutil
Class HashCommon

java.lang.Object
  extended byit.unimi.dsi.fastutil.HashCommon

public class HashCommon
extends Object

Common code for all hash-based classes. All hashing in fastutil is performed starting from a 32-bit integer associated to a key or value. For all integer types smaller than long, we just cast. In all other cases, we do some conversion using static code in this class. Note that we follow the conventions established by the various classes associated to primitive types (Boolean, Double, etc.).


Field Summary
static Object removed
          This reference is used to fill keys and values of removed entries (if they are objects).
 
Method Summary
static int double2int(double d)
          Returns the hash code that would be returned by Double.hashCode().
static int float2int(float f)
          Returns the hash code that would be returned by Float.hashCode().
static int long2int(long l)
          Returns the hash code that would be returned by Long.hashCode().
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

removed

public static final Object removed
This reference is used to fill keys and values of removed entries (if they are objects). null cannot be used as it would confuse the search algorithm in the presence of an actual null key.

Method Detail

float2int

public static final int float2int(float f)
Returns the hash code that would be returned by Float.hashCode().

Returns:
the same code as new Float(f).hashCode().

double2int

public static final int double2int(double d)
Returns the hash code that would be returned by Double.hashCode().

Returns:
the same code as new Double(f).hashCode().

long2int

public static final int long2int(long l)
Returns the hash code that would be returned by Long.hashCode().

Returns:
the same code as new Long(f).hashCode().