public static < T > Stream < T > streamOf ( Optional < T > value ) { return value . map ( Stream :: of ) . orElse ( Stream . empty ( ) ) ; }
If the given value is present returns it as a single - element stream . Otherwise returns an empty stream .