code: private static int matchesAt(CharSequence text, int offsetInText, CharSequence substring) {
          int len = substring.length();
          int textLength = text.length();
          if (textLength + offsetInText > len) {
              return -1;
          }
          int i = 0;
          for (int j = offsetInText; i < len; ++i, ++j) {
              char pc = substring.charAt(i);
              char tc = text.charAt(j);
              if (pc != tc) return -1;
          }
          return i;
      }
docs: Note: This method was moved from CollectionUtilities