Colt 1.0.1

cern.colt.map
Class HashFunctions

java.lang.Object
  |
  +--cern.colt.map.HashFunctions

public class HashFunctions
extends Object

Provides various hash functions.


Method Summary
static int hash(double value)
          Returns a hashcode for the specified value.
static int hash(float value)
          Returns a hashcode for the specified value.
static int hash(int value)
          Returns a hashcode for the specified value.
static int hash(long value)
          Returns a hashcode for the specified value.
static int hash(Object object)
          Returns a hashcode for the specified object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hash

public static int hash(double value)
Returns a hashcode for the specified value.
Returns:
a hash code value for the specified value.

hash

public static int hash(float value)
Returns a hashcode for the specified value.
Returns:
a hash code value for the specified value.

hash

public static int hash(int value)
Returns a hashcode for the specified value. The hashcode is computed as
 
 31^5*(d[0]*31^(n-1) + d[1]*31^(n-2) + ... + d[n-1])
 
using int arithmetic, where d[i] is the ith digit of the value, counting from the right, n is the number of decimal digits of the specified value, and ^ indicates exponentiation. (The hash value of the value zero is zero.)
Returns:
a hash code value for the specified value.

hash

public static int hash(long value)
Returns a hashcode for the specified value.
Returns:
a hash code value for the specified value.

hash

public static int hash(Object object)
Returns a hashcode for the specified object.
Returns:
a hash code value for the specified object.

Colt 1.0.1

Submit a bug or feature. Check the Colt home page for the latest news.