@Override
  public int next() {
    IntPair currentRange = _docIdRanges.get(_currentRangeId);
    if (_nextDocId <= currentRange.getRight()) {
      // Next document id is within the current range
      return _nextDocId++;
    }
    if (_currentRangeId < _numRanges - 1) {
      // Move to the next range
      _currentRangeId++;
      _nextDocId = _docIdRanges.get(_currentRangeId).getLeft();
      return _nextDocId++;
    } else {
      return Constants.EOF;
    }
  }
@Test
  public void testPairWithSameStartAndEnd() {
    SortedDocIdSet sortedDocIdSet = new SortedDocIdSet(Collections.singletonList(new Pairs.IntPair(1, 1)));
    BlockDocIdIterator iterator = sortedDocIdSet.iterator();
    List<Integer> result = new ArrayList<>();
    int docId;
    while ((docId = iterator.next()) != Constants.EOF) {
      result.add(docId);
    }
    assertEquals(result, Collections.singletonList(1));
  }