public static boolean equals(@Nullable Object obj1, @Nullable Object obj2) {
    if (obj1 == null) return obj2 == null;
    return obj1.equals(obj2);
  }
Utility methods applicable to (almost) any object. Includes null-safe variants of methods on class Object.
spock-core/src/main/java/org/spockframework/util/ObjectUtil.java