Is there any method by which I can join() to a group of threads instead of a single one?
Created May 4, 2012
Alex Chaffee Yes. Just join to each one in turn. That way, when the loop exits, you know that all the threads have exited -- whether it was the first thread or the seventh thread that took the longest, all threads will be waited for. Remember, join() on a thread that's already exited takes no time.
Iterator i = myThreads.iterator(); while (i.hasNext()) { ((Thread)i.next()).join(); }