Prototype: runSequential(List<Callable<Integer>>) -> List<Integer> throws Exception calls each task in input order once and returns results; stop on the first exception and propagate that exact exception object.

Final: runConcurrent(tasks,int workers) -> List<Integer> throws Exception requires workers>0, uses an owned fixed-size executor, and preserves input order in returned results. All tasks may run concurrently up to workers; empty input returns empty. If a task fails when its input-order future is observed, cancel outstanding tasks and propagate the original task Exception (not ExecutionException). On caller interruption cancel siblings and propagate InterruptedException. Always shut down and await executor termination; tasks in this exercise cooperate with interruption and terminate promptly. Preserve the task list. No leaked worker threads.

Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.

Java runs on this device with CheerpJ 4.3.