Code Room
Code reviewMedium
Question
Review this Java method that parallelizes a batch of tasks with its own executor.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
List<Result> runBatch(List<Task> tasks) throws Exception { ExecutorService pool = Executors.newFixedThreadPool(8); List<Future<Result>> futures = new ArrayList<>(); for (Task t : tasks) { futures.add(pool.submit(() -> process(t))); } List<Result> out = new ArrayList<>(); for (Future<Result> f : futures) { out.add(f.get()); // may throw } return out;}Run or narrate your approach, then ask the coach.