public boolean areValuesEqual(final Txn<ByteBuffer> txn,
                                  final ByteBuffer valueStoreKeyBuffer,
                                  final StagingValue newRefDataValue) {

        long currentValueHashCode = ValueStoreKeySerde.extractValueHashCode(valueStoreKeyBuffer);
        long newValueHashCode = newRefDataValue.getValueHashCode();
        boolean areValuesEqual;
        if (currentValueHashCode != newValueHashCode) {
            // valueHashCodes differ so values differ
            areValuesEqual = false;
        } else {
            // valueHashCodes match so need to do a full equality check
            final ByteBuffer currentValueBuf = getAsBytes(txn, valueStoreKeyBuffer)
                    .orElseThrow(() -> new RuntimeException("The value should exist at this point"));

            final ByteBuffer newValueBuffer = newRefDataValue.getValueBuffer();

            areValuesEqual = currentValueBuf.equals(newValueBuffer);
            if (!areValuesEqual) {
                // Hopefully this won't happen often, logging in case we want to track collisions.
                LAMBDA_LOGGER.debug("Hash collision");
            }
        }
        return areValuesEqual;
    }
Tests if the passed newRefDataValue is equal to the value associated with the
passed valueStoreKey (if there is one). If there is no value associated with
the passed valueStoreKey, false will be returned.
stroom-pipeline/src/main/java/stroom/pipeline/refdata/store/offheapstore/databases/ValueStoreDb.java