code: public static boolean equalObjects(Object o1, Object o2) {
          if (o1 == null) {
              return (o2 == null);
          } else if (o2 == null) {
              return false;
          } else {
              return o1.equals(o2);
          }
      }
docs: Utility function to make it easy to compare two, possibly null, objects.
  
  @param o1 first object
  @param o2 second object
  @return true iff either both objects are null, or
  neither are null and they are equal.