public static boolean isNameEqual ( AObject obj1 , AObject obj2 ) { // Not equal if the names are null, or empty, or not the same size if ( obj1 . name == null || obj2 . name == null || obj1 . name . length != obj2 . name . length || obj1 . name . length == 0 ) { return false ; } // Not equal if any name character is different for ( int i = 0 ; i < obj1 . name . length ; i ++ ) { if ( obj1 . name [ i ] != obj2 . name [ i ] ) { return false ; } } // Else equal return true ; }
Checks if two objects have the same name . The check is case sensitive .