StocksMonitor 1.5.0

hirondelle.stocks.util
Class HashCodeUtil

Object
  extended by HashCodeUtil

public final class HashCodeUtil
extends Object

Collected methods which allow easy implementation of hashCode. Example use case:

  public int hashCode(){
    final int result = HashCodeUtil.SEED;
    //collect the contributions of various fields
    result = HashCodeUtil.hash(result, fPrimitive);
    result = HashCodeUtil.hash(result, fObject);
    result = HashCodeUtil.hash(result, fArray);
    return result;
  }
 


Field Summary
static int SEED
          An initial value for a hashCode, to which is added contributions from fields.
 
Constructor Summary
HashCodeUtil()
           
 
Method Summary
static int hash(int aSeed, boolean aBoolean)
          booleans.
static int hash(int aSeed, boolean[] aArray)
          Arrays of booleans.
static int hash(int aSeed, byte[] aArray)
          Arrays of bytes.
static int hash(int aSeed, char aChar)
          chars.
static int hash(int aSeed, char[] aArray)
          Arrays of chars.
static int hash(int aSeed, double aDouble)
          doubles.
static int hash(int aSeed, double[] aArray)
          Arrays of doubles.
static int hash(int aSeed, float aFloat)
          floats.
static int hash(int aSeed, float[] aArray)
          Arrays of floats.
static int hash(int aSeed, int aInt)
          ints.
static int hash(int aSeed, int[] aArray)
          Arrays of integers.
static int hash(int aSeed, long aLong)
          longs.
static int hash(int aSeed, long[] aArray)
          Arrays of longs
static int hash(int aSeed, Object aObject)
          Possibly-null Object fields.
static int hash(int aSeed, Object[] aArray)
          Arrays of Objects.
static int hash(int aSeed, short[] aArray)
          Arrays of shorts.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEED

public static final int SEED
An initial value for a hashCode, to which is added contributions from fields. Using a non-zero value decreases collisons of hashCode values.

See Also:
Constant Field Values
Constructor Detail

HashCodeUtil

public HashCodeUtil()
Method Detail

hash

public static int hash(int aSeed,
                       boolean aBoolean)
booleans.


hash

public static int hash(int aSeed,
                       char aChar)
chars.


hash

public static int hash(int aSeed,
                       int aInt)
ints. Note that byte and short are handled by this method, through implicit conversion.


hash

public static int hash(int aSeed,
                       long aLong)
longs.


hash

public static int hash(int aSeed,
                       float aFloat)
floats.


hash

public static int hash(int aSeed,
                       double aDouble)
doubles.


hash

public static int hash(int aSeed,
                       Object aObject)
Possibly-null Object fields.


hash

public static int hash(int aSeed,
                       Object[] aArray)
Arrays of Objects.


hash

public static int hash(int aSeed,
                       boolean[] aArray)
Arrays of booleans.


hash

public static int hash(int aSeed,
                       char[] aArray)
Arrays of chars.


hash

public static int hash(int aSeed,
                       byte[] aArray)
Arrays of bytes.


hash

public static int hash(int aSeed,
                       short[] aArray)
Arrays of shorts.


hash

public static int hash(int aSeed,
                       int[] aArray)
Arrays of integers.


hash

public static int hash(int aSeed,
                       long[] aArray)
Arrays of longs


hash

public static int hash(int aSeed,
                       float[] aArray)
Arrays of floats.


hash

public static int hash(int aSeed,
                       double[] aArray)
Arrays of doubles.


StocksMonitor 1.5.0

Copyright Hirondelle Systems - License - Generated 2008Jul12.10.53