/** * chars. */ public static int hash(final int aSeed, final char aChar) { return firstTerm(aSeed) + aChar; }
/** * <code>aObject</code> is a possibly-null object field, and possibly an array. * * If <code>aObject</code> is an array, then each element may be a primitive or a possibly-null object. */ public static int hash(final int aSeed, final Object aObject) { int result = aSeed; if (aObject == null) { result = hash(result, 0); } else if (!isArray(aObject)) { result = hash(result, aObject.hashCode()); } else { final int length = Array.getLength(aObject); for (int idx = 0; idx < length; ++idx) { final Object item = Array.get(aObject, idx); // recursive call! result = hash(result, item); } } return result; }
/** * floats. */ public static int hash(final int aSeed, final float aFloat) { return hash(aSeed, Float.floatToIntBits(aFloat)); }
/** * <code>aObject</code> is a possibly-null object field, and possibly an array. * * If <code>aObject</code> is an array, then each element may be a primitive or a possibly-null object. */ public static int hash(final int aSeed, final Object aObject) { int result = aSeed; if (aObject == null) { result = hash(result, 0); } else if (!isArray(aObject)) { result = hash(result, aObject.hashCode()); } else { final int length = Array.getLength(aObject); for (int idx = 0; idx < length; ++idx) { final Object item = Array.get(aObject, idx); // recursive call! result = hash(result, item); } } return result; }
/** * doubles. */ public static int hash(final int aSeed, final double aDouble) { return hash(aSeed, Double.doubleToLongBits(aDouble)); }
/** * chars. */ public static int hash(final int aSeed, final char aChar) { return firstTerm(aSeed) + aChar; }
/** * floats. */ public static int hash(final int aSeed, final float aFloat) { return hash(aSeed, Float.floatToIntBits(aFloat)); }
/** * booleans. */ public static int hash(final int aSeed, final boolean aBoolean) { return firstTerm(aSeed) + (aBoolean ? 1 : 0); }
/** * doubles. */ public static int hash(final int aSeed, final double aDouble) { return hash(aSeed, Double.doubleToLongBits(aDouble)); }
/** * longs. */ public static int hash(final int aSeed, final long aLong) { return firstTerm(aSeed) + (int) (aLong ^ (aLong >>> 32)); }
/** * longs. */ public static int hash(final int aSeed, final long aLong) { return firstTerm(aSeed) + (int) (aLong ^ (aLong >>> 32)); }
/** * ints. * * <p> * Note that byte and short are handled by this method, through implicit conversion. */ public static int hash(final int aSeed, final int aInt) { return firstTerm(aSeed) + aInt; }
/** * booleans. */ public static int hash(final int aSeed, final boolean aBoolean) { return firstTerm(aSeed) + (aBoolean ? 1 : 0); }
/** * ints. * * <p> * Note that byte and short are handled by this method, through implicit conversion. */ public static int hash(final int aSeed, final int aInt) { return firstTerm(aSeed) + aInt; }