code: private int toBoundedNext(int amount) throws FetchException {
          if (mEndBound == null) {
              return toNext(amount);
          }
  
          int count = 0;
  
          disableValue();
          try {
              while (amount > 0) {
                  if (!toNext()) {
                      break;
                  }
  
                  byte[] currentKey = getCurrentKey();
                  if (currentKey == null) {
                      break;
                  }
  
                  int result = compareKeysPartially(currentKey, mEndBound);
                  if (result >= 0) {
                      if (result > 0 || !mInclusiveEnd) {
                          break;
                      }
                  }
  
                  if (!prefixMatches()) {
                      break;
                  }
  
                  count++;
                  amount--;
              }
          } finally {
              enableKeyAndValue();
          }
  
          return count;
      }
docs: Calls toNext, but considers end bound.