Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
try (ExecutorService executor = Executors.newVirtualThreadExecutor()) {
    Callable<String> task1 = () -> "foo";
    Callable<String> task2 = () -> "bar";
    Callable<String> task3 = () -> "baz";
    executor.submit(List.of(task1, task2, task3));
       .map(CompletableFutureFuture::join)
       .forEach(System.out::println);
}

...