I want to prepend a stream with an Optional. Since Stream.concat can only concatinate Streams I have this question:
Stream.concat
How do I convert an Optional
I can recommend Guava's Streams.stream(optional) method if you are not on Java 9. A simple example:
Streams.stream(optional)
Streams.stream(Optional.of("Hello"))
Also possible to static import Streams.stream, so you can just write
Streams.stream
stream(Optional.of("Hello"))