+
+ // Test for equality, while taking care to avoid
+ // dereferencing a null pointer.
+ // Note that two null pointers are considered equal.
+ public static boolean objsAreEqual(Object a, Object b)
+ {
+ if ((null == a) || (null == b)) {
+ return (a == b);
+ }
+
+ return a.equals(b);
+ }
+
+ // Return 1 if obj is null, or obj.hashCode() otherwise
+ public static int objHashCode(Object obj)
+ {
+ if (null == obj) {
+ return 1;
+ }
+ return obj.hashCode();
+ }