public static List<ModEntry> sortAndMerge(List<ModEntry> modifications) {
    modifications.sort(Comparator.comparing(ModEntry::getTimeRange));
    List<ModEntry> result = new ArrayList<>();
    if (!modifications.isEmpty()) {
      ModEntry current = modifications.get(0).clone();
      for (int i = 1; i < modifications.size(); i++) {
        ModEntry next = modifications.get(i);
        if (canMerge(current, next)) {
          current.getTimeRange().merge(next.getTimeRange());
        } else {
          result.add(current);
          current = next.clone();
        }
      }
      result.add(current);
    }
    return result;
  }
construct a deletion list from a memtable.

@param memTable memtable
@param timeLowerBound time watermark
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ModificationUtils.java