LangUtilspublic final class LangUtils extends Object A set of utility methods to help produce consistent
{@link Object#equals equals} and {@link Object#hashCode hashCode} methods. |
Fields Summary |
---|
public static final int | HASH_SEED | public static final int | HASH_OFFSET |
Constructors Summary |
---|
private LangUtils()Disabled default constructor.
|
Methods Summary |
---|
public static boolean | equals(java.lang.Object obj1, java.lang.Object obj2)
return obj1 == null ? obj2 == null : obj1.equals(obj2);
| public static boolean | equals(java.lang.Object[] a1, java.lang.Object[] a2)
if (a1 == null) {
if (a2 == null) {
return true;
} else {
return false;
}
} else {
if (a2 != null && a1.length == a2.length) {
for (int i = 0; i < a1.length; i++) {
if (!equals(a1[i], a2[i])) {
return false;
}
}
return true;
} else {
return false;
}
}
| public static int | hashCode(int seed, int hashcode)
return seed * HASH_OFFSET + hashcode;
| public static int | hashCode(int seed, boolean b)
return hashCode(seed, b ? 1 : 0);
| public static int | hashCode(int seed, java.lang.Object obj)
return hashCode(seed, obj != null ? obj.hashCode() : 0);
|
|