package u06_1; abstract class Concurrent { private ArgType[] args; public Concurrent(ArgType[] args) { this.args = args; } void run() throws InterruptedException { Thread[] threads = new Thread[args.length]; for (int i = 0; i < args.length; i++) { final ArgType arg = args[i]; threads[i] = new Thread(() -> perform(arg)); threads[i].start(); } for (int i = 0; i < threads.length; i++) { threads[i].join(); } } abstract void perform(ArgType arg); }