Package org.codehaus.groovy.util

# Class HashCodeHelper

java.lang.Object
org.codehaus.groovy.util.HashCodeHelper

@GroovyABI(since="1.6.0") public class HashCodeHelper extends Object
A utility class to help calculate hashcode values using an algorithm similar to that outlined in "Effective Java, Joshua Bloch, 2nd Edition".

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HashCodeHelper()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static int`
  `initHash()`
  Returns the initial seed for a hash-code calculation sequence.
  `static int`
  `updateHash(int current, boolean var)`
  Mixes a boolean value into an in-progress hash code.
  `static int`
  `updateHash(int current, boolean[] var)`
  Mixes a boolean-array value into an in-progress hash code.
  `static int`
  `updateHash(int current, byte[] var)`
  Mixes a byte-array value into an in-progress hash code.
  `static int`
  `updateHash(int current, char var)`
  Mixes a character value into an in-progress hash code.
  `static int`
  `updateHash(int current, char[] var)`
  Mixes a char-array value into an in-progress hash code.
  `static int`
  `updateHash(int current, double var)`
  Mixes a double value into an in-progress hash code.
  `static int`
  `updateHash(int current, double[] var)`
  Mixes a double-array value into an in-progress hash code.
  `static int`
  `updateHash(int current, float var)`
  Mixes a float value into an in-progress hash code.
  `static int`
  `updateHash(int current, float[] var)`
  Mixes a float-array value into an in-progress hash code.
  `static int`
  `updateHash(int current, int var)`
  Mixes an integer value into an in-progress hash code.
  `static int`
  `updateHash(int current, int[] var)`
  Mixes an int-array value into an in-progress hash code.
  `static int`
  `updateHash(int current, long var)`
  Mixes a long value into an in-progress hash code.
  `static int`
  `updateHash(int current, long[] var)`
  Mixes a long-array value into an in-progress hash code.
  `static int`
  `updateHash(int current, short[] var)`
  Mixes a short-array value into an in-progress hash code.
  `static int`
  `updateHash(int current, Character var)`
  Mixes a boxed character value into an in-progress hash code.
  `static int`
  `updateHash(int current, Double var)`
  Mixes a boxed double value into an in-progress hash code.
  `static int`
  `updateHash(int current, Float var)`
  Mixes a boxed float value into an in-progress hash code.
  `static int`
  `updateHash(int current, Integer var)`
  Mixes a boxed integer value into an in-progress hash code.
  `static int`
  `updateHash(int current, Long var)`
  Mixes a boxed long value into an in-progress hash code.
  `static int`
  `updateHash(int current, Object var)`
  Mixes an object or object-array value into an in-progress hash code.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### HashCodeHelper

    public HashCodeHelper()

- ## Method Details

  - ### initHash

    public static int initHash()
    Returns the initial seed for a hash-code calculation sequence.
    Returns:
      the starting hash value

  - ### updateHash

    public static int updateHash(int current, boolean var)
    Mixes a boolean value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, char var)
    Mixes a character value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, Character var)
    Mixes a boxed character value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, int var)
    Mixes an integer value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, Integer var)
    Mixes a boxed integer value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, long var)
    Mixes a long value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, Long var)
    Mixes a boxed long value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, float var)
    Mixes a float value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, Float var)
    Mixes a boxed float value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, double var)
    Mixes a double value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, Double var)
    Mixes a boxed double value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, Object var)
    Mixes an object or object-array value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, boolean[] var)
    Mixes a boolean-array value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, char[] var)
    Mixes a char-array value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, byte[] var)
    Mixes a byte-array value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, short[] var)
    Mixes a short-array value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, int[] var)
    Mixes an int-array value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, long[] var)
    Mixes a long-array value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, float[] var)
    Mixes a float-array value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value

  - ### updateHash

    public static int updateHash(int current, double[] var)
    Mixes a double-array value into an in-progress hash code.
    Parameters:
      `current` - the current hash value
      `var` - the value to mix in
    Returns:
      the updated hash value