public static boolean isMatchingName(String nameA,String nameB){
  int a=nameA.length();
  int b=nameB.length();
  if (a == b) {
    return nameA.equals(nameB);
  }
 else   if (a < b - 1) {
    return nameB.endsWith(nameA) && nameB.charAt(b - a - 1) == '.';
  }
 else   if (b < a - 1) {
    return nameA.endsWith(nameB) && nameA.charAt(a - b - 1) == '.';
  }
 else {
    return false;
  }
}

public static boolean isMatchingName ( String nameA , String nameB ) { int a = nameA . length ( ) ; int b = nameB . length ( ) ; if ( a == b ) { return nameA . equals ( nameB ) ; } else if ( a < b - 1 ) { return nameB . endsWith ( nameA ) && nameB . charAt ( b - a - 1 ) == '.' ; } else if ( b < a - 1 ) { return nameA . endsWith ( nameB ) && nameA . charAt ( a - b - 1 ) == '.' ; } else { return false ; } }
returns whether the two names match . they match if they are equal , or if they are the same name but one is missing a dot - separated qualifier .
