private static ArrayList<String> mergeVmOptionsLines(List<String> importLines, List<String> currentLines, Logger log) {
    var result = new ArrayList<String>(importLines.size() + currentLines.size());
    var preferCurrentXmx = false;

    nextLine:
    for (var line : importLines) {
      if (line.startsWith("-D")) {
        var p = line.indexOf('=');
        if (p > 0) {
          var prefix = line.substring(0, p + 1);
          for (var l : currentLines) {
            if (l.startsWith(prefix)) {
              continue nextLine;
            }
          }
        }
      }
      else if (line.startsWith("-Xmx") && isLowerValue("-Xmx", line.substring(4), currentLines)) {
        preferCurrentXmx = true;
        continue nextLine;
      }
      result.add(line);
    }

    for (var line : currentLines) {
      if (preferCurrentXmx || !line.startsWith("-Xmx")) {
        result.add(line);
      }
    }
    return result;
  }
private static ArrayList<String> mergeVmOptionsLines(List<String> importLines, List<String> currentLines, Logger log)