Objects { public static boolean equal(@Nullable final Object obj1, @Nullable final Object obj2) { if (obj1 == obj2) { return true; } if (obj1 != null) { if (obj2 != null) { final boolean eq = obj1.equals(obj2); assert obj2.equals(obj1) == eq; return eq; } else { return false; } } else { assert obj2 != null; return false; } } private  Objects(); static boolean equal(@Nullable final Object obj1, @Nullable final Object obj2); static int hashCode(@Nullable final Double... values); static int hashCode(@Nullable final String... values); static int hashCode(@Nullable final Object... values); @Nonnull static T notNullOr(@Nullable final T value, @Nonnull final T defaultValue);  }
@Test public void testEqual() { LOG.info("testEqual"); final String s0 = ""; final String s1 = "abc"; final String s2 = "abc"; final String s3 = "Abc"; Assert.assertTrue(Objects.equal(null, null)); Assert.assertFalse(Objects.equal(s0, null)); Assert.assertFalse(Objects.equal(null, s0)); Assert.assertFalse(Objects.equal(s1, null)); Assert.assertFalse(Objects.equal(null, s1)); Assert.assertTrue(Objects.equal(s1, s1)); Assert.assertTrue(Objects.equal(s1, s2)); Assert.assertFalse(Objects.equal(s1, s3)); }