Class HashCodeUtil


  • public final class HashCodeUtil
    extends Object
    • Field Summary

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

      Constructors 
      Constructor Description
      HashCodeUtil()  
    • 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.
        Parameters:
        aSeed - the a seed
        aBoolean - the a boolean
        Returns:
        the int
      • hash

        public static int hash​(int aSeed,
                               char aChar)
        chars.
        Parameters:
        aSeed - the a seed
        aChar - the a char
        Returns:
        the int
      • hash

        public static int hash​(int aSeed,
                               int aInt)
        ints.
        Parameters:
        aSeed - the a seed
        aInt - the a int
        Returns:
        the int
      • hash

        public static int hash​(int aSeed,
                               long aLong)
        longs.
        Parameters:
        aSeed - the a seed
        aLong - the a long
        Returns:
        the int
      • hash

        public static int hash​(int aSeed,
                               float aFloat)
        floats.
        Parameters:
        aSeed - the a seed
        aFloat - the a float
        Returns:
        the int
      • hash

        public static int hash​(int aSeed,
                               double aDouble)
        doubles.
        Parameters:
        aSeed - the a seed
        aDouble - the a double
        Returns:
        the int
      • hash

        public static int hash​(int aSeed,
                               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.
        Parameters:
        aSeed - the a seed
        aObject - the a object
        Returns:
        the int