parquet-column/src/main/java/org/apache/parquet/internal/filter2/columnindex/RowRanges.java
static RowRanges intersection(RowRanges left, RowRanges right) {
    RowRanges result = new RowRanges();

    int rightIndex = 0;
    for (Range l : left.ranges) {
      for (int i = rightIndex, n = right.ranges.size(); i < n; ++i) {
        Range r = right.ranges.get(i);
        if (l.isBefore(r)) {
          break;
        } else if (l.isAfter(r)) {
          rightIndex = i + 1;
          continue;
        }
        result.add(Range.intersection(l, r));
      }
    }

    return result;
  }
static RowRanges intersection(RowRanges left, RowRanges right) {
    RowRanges result = new RowRanges();

    int rightIndex = 0;
    for (Range l : left.ranges) {
      for (int i = rightIndex, n = right.ranges.size(); i < n; ++i) {
        Range r = right.ranges.get(i);
        if (l.isBefore(r)) {
          break;
        } else if (l.isAfter(r)) {
          rightIndex = i + 1;
          continue;
        }
        result.add(Range.intersection(l, r));
      }
    }

    return result;
  }
/*
Calculates the intersection of the two specified RowRanges object. Two ranges intersect if they have common
elements otherwise the result is empty.
For example:
[113, 241] ∩ [221, 340] = [221, 241]
while
[113, 230] ∩ [231, 340] = <EMPTY>

The result RowRanges object will contain all the row indexes there were contained in both of the specified objects