public final static < T > Stream < String > flatMapURL ( final Stream < T > stream , final Function < ? super T , URL > fn ) { return stream . flatMap ( fn . andThen ( url -> ExceptionSoftener . softenSupplier ( ( ) -> { final BufferedReader in = new BufferedReader ( new InputStreamReader ( url . openStream ( ) ) ) ; return in . lines ( ) ; } ) . get ( ) ) ) ; }
Perform a flatMap operation where the result will be a flattened stream of Strings from the text loaded from the supplied URLs