private Optional<RefDataValue> getValueByRange(final NavigableMap<Range<Long>, RefDataValue> rangeSubMap,
                                                   final long key) {

        // We want to scan backwards over all keys with the passed mapDefinitionUid,
        // starting with a range from == key. E.g. with the following data
        // in the order it appears in the map

        // 400-500
        // 300-400
        // 200-300
        // 100-200

        // key  | DB keys returned
        // -----|-----------------
        // 50   | [no rows]
        // 150  | 100-200
        // 300  | 300-400, 200-300, 100-200
        // 1000 | 400-500, 300-400, 200-300, 100-200

        RefDataValue refDataValue = null;

        // the to part doesn't matter as the comparator only considers the from part
        final Range<Long> startKey = new Range<>(key, null);

        // create a sub-set of the map starting at the key of interest or the next smallest
        // range from value. Note the map is reverse sorted to increase confusion.
        final SortedMap<Range<Long>, RefDataValue> tailMap = rangeSubMap.tailMap(startKey);
        for (Map.Entry<Range<Long>, RefDataValue> entry : tailMap.entrySet()) {
            // see if our key is in the found range
            if (entry.getKey().contains(key)) {
                // found our entry
                refDataValue = entry.getValue();
                LOGGER.trace("Found our match {}", entry);
                break;
            }
        }

        if (refDataValue == null) {
            LOGGER.trace("No match found");
        }

        return Optional.ofNullable(refDataValue);
    }
A heap based implementation of the {@link RefDataStore}
that is intended for use with reference data with a very short life, i.e. context
data that is transient and only required for the life of a single pipeline processor
task. As such it is not thread safe and only intended to be used to by a single thread.
It also does not support purge operations as it is expected that the store will be created,
populated, used, then destroyed when no longer needed.
stroom-pipeline/src/main/java/stroom/pipeline/refdata/store/onheapstore/RefDataOnHeapStore.java