code: boolean first(RowCursor minCursor, 
                  RowCursor resultCursor, 
                  boolean isMatch)
    {
      int ptr = _rowHead;
      int rowLength = resultCursor.length();
      int removeLength = resultCursor.removeLength();
      int sortOffset = _rowSortHead;
      
      byte []buffer = _buffer;
  
      while (ptr < sortOffset) {
        int code = buffer[ptr] & CODE_MASK;
        
        int minCmp;
        int cmp;
  
        switch (code) {
        case INSERT:
          if ((minCmp = minCursor.compareKeyRow(buffer, ptr)) <= 0
              && ((cmp = resultCursor.compareKeyRow(buffer, ptr)) > 0
                  || cmp == 0 && ! isMatch)) {
            fillMatch(ptr, resultCursor);
            
            if (minCmp == 0) {
              return true;
            }
            
            isMatch = true;
          }
  
          ptr += rowLength;
          break;
          
        case INSERT_DEAD:
          ptr += rowLength;
          break;
          
        case REMOVE:
          if ((minCmp = minCursor.compareKeyRemove(buffer, ptr)) <= 0
              && ((cmp = resultCursor.compareKeyRemove(buffer, ptr)) > 0
                  || cmp == 0 && ! isMatch)) {
            resultCursor.setRemove(buffer, ptr);
            //resultCursor.setKey(buffer, ptr + 1);
            
            if (minCmp == 0) {
              return true;
            }
            
            isMatch = true;
          }
  
          ptr += removeLength;
          break;
          
        default:
          System.out.println("BROKEN_ENTRY:");
          return false;
        }
      }
  
      if (sortOffset < BLOCK_SIZE) {
        return findFirstSorted(minCursor, resultCursor, isMatch);
      }
      else {
        return isMatch;
      }
    }
docs: Finds the row with the smallest key larger than minCursor
  and fills the cursor.