A parallel HttpClient sendAync question
Weijun Wang
weijun.wang at oracle.com
Tue Nov 13 13:27:52 UTC 2018
>
> 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
>
More information about the net-dev
mailing list