public static boolean equals(Object o1,Object o2){
  if (o1 == o2)   return true;
  if (o1 == null || o2 == null)   return false;
  Class c=o1.getClass();
  if (c != o2.getClass())   return false;
  if (c.isArray()) {
    int length=Array.getLength(o1);
    int length2=Array.getLength(o2);
    if (length != length2)     return false;
    for (int i=0; i < length; i++) {
      Object c1=Array.get(o1,i);
      Object c2=Array.get(o2,i);
      if (!equals(c1,c2))       return false;
    }
    return true;
  }
 else {
    return o1.equals(o2);
  }
}

public static boolean equals ( Object o1 , Object o2 ) { if ( o1 == o2 ) return true ; if ( o1 == null || o2 == null ) return false ; Class c = o1 . getClass ( ) ; if ( c != o2 . getClass ( ) ) return false ; if ( c . isArray ( ) ) { int length = Array . getLength ( o1 ) ; int length2 = Array . getLength ( o2 ) ; if ( length != length2 ) return false ; for ( int i = 0 ; i < length ; i ++ ) { Object c1 = Array . get ( o1 , i ) ; Object c2 = Array . get ( o2 , i ) ; if ( ! equals ( c1 , c2 ) ) return false ; } return true ; } else { return o1 . equals ( o2 ) ; } }
general equals method that compares two objects considering null values and multi - dimensional arrays . in case of arrays - their members are compared recursively .
