private static boolean strContains(Set<String> messages,String messageKey){
  String key=messageKey;
  do {
    if (messages.contains(key)) {
      return true;
    }
    int dot=key.indexOf('.');
    if (dot < 0)     return false;
    key=key.substring(dot + 1);
  }
 while (true);
}

private static boolean strContains ( Set < String > messages , String messageKey ) { String key = messageKey ; do { if ( messages . contains ( key ) ) { return true ; } int dot = key . indexOf ( '.' ) ; if ( dot < 0 ) return false ; key = key . substring ( dot + 1 ) ; } while ( true ) ; }
instead of a precise comparison , we incrementally remove leading dot - separated strings until we find a match . for example if messages contains " y . z " and we look for " x . y . z " we find a match after removing the first " x . " . compare to sourcechecker . fullmessageof .
