code: public static String applyCodeReplacements(Iterable<CodeReplacement> replacements, String code) {
      List<CodeReplacement> sortedReplacements = ORDER_CODE_REPLACEMENTS.sortedCopy(replacements);
      validateNoOverlaps(sortedReplacements);
  
      StringBuilder sb = new StringBuilder();
      int lastIndex = 0;
      for (CodeReplacement replacement : sortedReplacements) {
        sb.append(code, lastIndex, replacement.getStartPosition());
        sb.append(replacement.getNewContent());
        lastIndex = replacement.getEndPosition();
      }
      if (lastIndex <= code.length()) {
        sb.append(code, lastIndex, code.length());
      }
      return sb.toString();
    }
docs: Applies the provided set of code replacements to the code and returns the transformed code.
  The code replacements may not have any overlap.