I want to run 10 APIs in parallel. Each API returns some values. I want to stop when total count of values are equal to 100 i.e I don't want to wait for all the 10 APIs if I get my 100 results before getting results of all APIs.
So I was thinking to play with CompletableFuture.anyOf() in loop and return but I am unable to figure out the right syntax for the same. Also if there is some other efficient way to do so?
Please reply.
Thanks in advance!