private Optional<NearestKeyValue> getNearest(
      final Bytes key,
      final Function<Bytes, Optional<NearestKeyValue>> ourNearestFunction,
      final Function<Bytes, Optional<NearestKeyValue>> parentNearestFunction,
      final boolean isAfter)
      throws StorageException {

    final Optional<NearestKeyValue> ourNearest = ourNearestFunction.apply(key);
    final Optional<NearestKeyValue> parentNearest = parentNearestFunction.apply(key);

    if (ourNearest.isPresent() && parentNearest.isPresent()) {
      return compareNearest(ourNearest, parentNearest, key, isAfter);
    } else if (ourNearest.isPresent()) {
      return ourNearest;
    } else {
      return parentNearest;
    }
  }
Constructor which takes an explicit backing map for the layered key value storage.

@param map the backing map
@param parent the parent key value storage for this layered storage.
services/kvstore/src/main/java/org/hyperledger/besu/services/kvstore/LayeredKeyValueStorage.java