Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Optional; import java.util.stream.Stream; public class Main { public static <T> Stream<T> toStream(Optional<T> optional) { if (optional.isPresent()) { return Stream.of(optional.get()); } return Stream.empty(); } }