public static <T> Stream<T> stream(Optional<T> value) {
        return value.map(Stream::of).orElseGet(Stream::empty);
    }
Converts an Optional into a Stream that can be used in a flatmap.

<p>This is a polyfill of Java 9's {@code Optional#stream}.

@param value Value to convert to a stream.
@param <T> Value type.
@return A stream that contains a present value or a stream that is empty.
smithy-utils/src/main/java/software/amazon/smithy/utils/OptionalUtils.java