parquet-column/src/main/java/org/apache/parquet/internal/filter2/columnindex/RowRanges.java
private void add(Range range) {
    Range rangeToAdd = range;
    for (int i = ranges.size() - 1; i >= 0; --i) {
      Range last = ranges.get(i);
      assert !last.isAfter(range);
      Range u = Range.union(last, rangeToAdd);
      if (u == null) {
        break;
      }
      rangeToAdd = u;
      ranges.remove(i);
    }
    ranges.add(rangeToAdd);
  }
private void add(Range range) {
    Range rangeToAdd = range;
    for (int i = ranges.size() - 1; i >= 0; --i) {
      Range last = ranges.get(i);
      assert !last.isAfter(range);
      Range u = Range.union(last, rangeToAdd);
      if (u == null) {
        break;
      }
      rangeToAdd = u;
      ranges.remove(i);
    }
    ranges.add(rangeToAdd);
  }
/*
Adds a range to the end of the list of ranges. It maintains the disjunct ascending order(*) of the ranges by
trying to union the specified range to the last ranges in the list. The specified range shall be larger(*) than
the last one or might be overlapped with some of the last ones.
(*) [a, b] < [c, d] if b < c