I have a list of Future
tasks
futureList.add(executor.submit(new Callable(someList)));
and while those are getting executed I want to get resulting items out of it. But how can I make it without looping all the time through it and checking if the futuretask is done, and then getting its result?
for (int i = 0; i < futureList.size(); i++) {
if (futureList.get(i).isDone()) {
.....
}}
I thought about making some additional notify-wait structure but still I would have to know which thread finished so it doesn't help me avoid looping all the time. Any advice?