> 
> That's what I would use too. Though Chris Y.'s suggestion below
> should also work:
> 
> On 13/11/2018 03:41, Chris Yin wrote: > lines.flapMap(x -> 
> Stream.ofNullable(findURIFrom(x)))
>>    .map(l -> download(c, l))
>>    .collect(Collectors.toList())
>>    .forEach(f -> f.join());
> 
> since the collection should exhaust the stream before starting
> the forEach loop.

Yes, this should work.

While I know the last forEach here is not Stream::forEach, I cannot stop 
thinking there are 2 terminal operations in this call chain. Almost feel like 
cheating. :-)

--Max

> 
> best regards,
> 
> -- daniel
> 

Reply via email to