|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metamatrix.core.util.HashCodeUtil
public final class HashCodeUtil
This class provides utility functions for generating good hash codes. Hash codes generated with these methods should have a reasonably good distribution when placed in a hash structure such as Hashtable, HashSet, or HashMap.
General usage is something like:
public int hashCode() { int hc = 0; // or = super.hashCode(); hc = HashCodeUtil.hashCode(hc, intField); hc = HashCodeUtil.hashCode(hc, objectField); // etc, etc return hc; }
Constructor Summary | |
---|---|
HashCodeUtil()
|
Method Summary | |
---|---|
static int |
expHashCode(int previous,
java.util.Collection x)
Compute a hash code on a large collection by walking the list and combining the hash code at every exponential index: 1, 2, 4, 8, ... |
static int |
expHashCode(int previous,
java.util.List x)
Compute a hash code on a large list by walking the list and combining the hash code at every exponential index: 1, 2, 4, 8, ... |
static int |
expHashCode(int previous,
java.lang.Object[] x)
Compute a hash code on a large array by walking the list and combining the hash code at every exponential index: 1, 2, 4, 8, ... |
static int |
hashCode(int previous,
boolean x)
|
static int |
hashCode(int previous,
double x)
|
static int |
hashCode(int previous,
float x)
|
static int |
hashCode(int previous,
int x)
|
static int |
hashCode(int previous,
long x)
|
static int |
hashCode(int previous,
java.lang.Object x)
|
static int |
hashCode(int previous,
java.lang.Object[] x)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HashCodeUtil()
Method Detail |
---|
public static final int hashCode(int previous, boolean x)
public static final int hashCode(int previous, int x)
public static final int hashCode(int previous, long x)
public static final int hashCode(int previous, float x)
public static final int hashCode(int previous, double x)
public static final int hashCode(int previous, java.lang.Object x)
public static final int hashCode(int previous, java.lang.Object[] x)
public static final int expHashCode(int previous, java.lang.Object[] x)
public static final int expHashCode(int previous, java.util.List x)
public static final int expHashCode(int previous, java.util.Collection x)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |