@Override
  public Stream<Pair<byte[], byte[]>> stream(final SegmentIdentifier segmentId) {
    throwIfClosed();
    var ourLayerState = hashValueStore.computeIfAbsent(segmentId, s -> newSegmentMap());

    PeekingIterator<Map.Entry<Bytes, Optional<byte[]>>> ourIterator =
        new PeekingIterator<>(ourLayerState.entrySet().stream().iterator());
    PeekingIterator<Pair<byte[], byte[]>> parentIterator =
        new PeekingIterator<>(parent.stream(segmentId).iterator());

    return StreamSupport.stream(
            Spliterators.spliteratorUnknownSize(
                new LayeredIterator(ourIterator, parentIterator), ORDERED | SORTED | DISTINCT),
            false)
        .filter(e -> e.getValue() != null);
  }
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