net.sf.okapi.common

## Class HashCodeUtil

- java.lang.Object
- - net.sf.okapi.common.HashCodeUtil

-     public final class HashCodeUtil
      extends java.lang.Object

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

       public int hashCode() {
              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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `SEED` An initial value for a `hashCode`, to which is added contributions from fields.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HashCodeUtil()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `hash(int aSeed, boolean aBoolean)`
    `static int` | `hash(int aSeed, char aChar)`
    `static int` | `hash(int aSeed, double aDouble)`
    `static int` | `hash(int aSeed, float aFloat)`
    `static int` | `hash(int aSeed, int aInt)`
    `static int` | `hash(int aSeed, long aLong)`
    `static int` | `hash(int aSeed, java.lang.Object aObject)` `aObject` is a possibly-null object field, and possibly an array.

    - ### Methods inherited from class java.lang.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 collisions of `hashCode` values.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### HashCodeUtil

          public HashCodeUtil()

  - ### Method Detail

    - #### hash

          public static int hash(int aSeed,
                 boolean aBoolean)

      Returns:
        hash code for a boolean.

    - #### hash

          public static int hash(int aSeed,
                 char aChar)

      Returns:
        has code for a char value.

    - #### hash

          public static int hash(int aSeed,
                 int aInt)

      Returns:
        hash code for int.

    - #### hash

          public static int hash(int aSeed,
                 long aLong)

      Returns:
        hash code for a long value.

    - #### hash

          public static int hash(int aSeed,
                 float aFloat)

      Returns:
        a hash code for a float value.

    - #### hash

          public static int hash(int aSeed,
                 double aDouble)

      Returns:
        a hash code for a double value.

    - #### hash

          public static int hash(int aSeed,
                 java.lang.Object aObject)

      `aObject` is a possibly-null object field, and possibly an array. If `aObject` is an array, then each element may be a primitive or a possibly-null object.