Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumJavaExecutorService usageSingle-choice MCQ

Several Callables are passed to ExecutorService.invokeAny. One returns quickly, others are slow or throw. What does invokeAny return?

List<Callable<String>> tasks = List.of( () -> { Thread.sleep(200); return "slow"; }, () -> "fast" ); String r = es.invokeAny(tasks);