How to convert an Optional into a Stream? February 12, 2023 by Tarik If restricted with Java-8, you can do this: Stream<String> texts = optional.map(Stream::of).orElseGet(Stream::empty);