public Optional<UID> getMaxUid(final Txn<ByteBuffer> txn, PooledByteBuffer pooledByteBuffer) {

        try (CursorIterable<ByteBuffer> iterable = getLmdbDbi().iterate(txn, KeyRange.allBackward())) {
            final Iterator<KeyVal<ByteBuffer>> iterator = iterable.iterator();

            if (iterator.hasNext()) {
                final ByteBuffer keyBuffer = iterator.next().key();
                final UID uid = keySerde.extractUid(keyBuffer);
                final ByteBuffer copyByteBuffer = pooledByteBuffer.getByteBuffer();
                copyByteBuffer.clear();
                final UID uidClone = uid.cloneToBuffer(pooledByteBuffer.getByteBuffer());
                return Optional.ofNullable(uidClone);
            } else {
                return Optional.empty();
            }
        }
    }
Apply the passes entryConsumer for each entry found matching the supplied UID
stroom-pipeline/src/main/java/stroom/pipeline/refdata/store/offheapstore/databases/RangeStoreDb.java