public class Hashcoder extends Object
 public int hashCode() {
   int result = Hashcoder.SEED;
   result = Hashcoder.hash(result, this.getName());
   result = Hashcoder.hash(result, this.getAge());
   return result;
 }
 | Modifier and Type | Field and Description | 
|---|---|
| static int | PRIMEThe prime number used to multiply any calculated hashcode seed by
 i.e. result = PRIME*result + c
 Where result is the result of the previous calculation (at first this will
 be seed) and c is the calculated int to add to result | 
| static int | SEEDAn initial value for a  hashCode, to which we add
 contributions from fields. | 
| Constructor and Description | 
|---|
| Hashcoder() | 
| Modifier and Type | Method and Description | 
|---|---|
| static int | hash(int seed,
    boolean b) | 
| static int | hash(int seed,
    char c) | 
| static int | hash(int seed,
    double d)double support which is done using the same techinque as float hashing
 except we convert to a long not to an int. | 
| static int | hash(int seed,
    float f)float support done via  Float.floatToIntBits(float)which allows
 the encoding of a float as an int. | 
| static int | hash(int seed,
    int i)Used for ints, bytes and shorts | 
| static int | hash(int seed,
    long l)long support done by shifting by 32 (using unsigned shift) | 
| static int | hash(int seed,
    Object o)ois a possibly-null object field, and possibly an
 array. | 
public static final int SEED
hashCode, to which we add
 contributions from fields. Using a non-zero value decreases collisions of
 hashCode values.public static final int PRIME
public Hashcoder()
public static int hash(int seed, boolean b)
public static int hash(int seed, char c)
public static int hash(int seed, int i)
public static int hash(int seed, long l)
public static int hash(int seed, float f)
Float.floatToIntBits(float) which allows
 the encoding of a float as an int. We can then hash as normal.public static int hash(int seed, double d)
Copyright © 2000–2017 BioJava. All rights reserved.