public final static < T > Stream < T > optionalToStream ( final Optional < T > optional ) { if ( optional . isPresent ( ) ) return Stream . of ( optional . get ( ) ) ; return Stream . of ( ) ; }
Convert an Optional to a Stream