code: public CursorIterator<T> iterate(final Txn<T> txn, final KeyRange<T> range,
                                     final Comparator<T> comparator) {
      if (SHOULD_CHECK) {
        requireNonNull(txn);
        requireNonNull(range);
        txn.checkReady();
      }
      final Comparator<T> useComp;
      if (comparator == null) {
        useComp = compFunc == null ? txn.comparator() : compFunc;
      } else {
        useComp = comparator;
      }
      return new CursorIterator<>(txn, this, range, useComp);
    }
docs: Iterate the database in accordance with the provided {@link KeyRange} and
  {@link Comparator}.
  
  <p>
  If a comparator is provided, it must reflect the same ordering as LMDB uses
  for cursor operations (eg first, next, last, previous etc).
  
  <p>
  If a null comparator is provided, any comparator provided when opening the
  database is used. If no database comparator was specified, the buffer's
  default comparator is used. Such buffer comparators reflect LMDB's default
  lexicographical order.
  
  @param txn        transaction handle (not null; not committed)
  @param range      range of acceptable keys (not null)
  @param comparator custom comparator for keys (may be null)
  @return iterator (never null)