MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

concurrent/QuittingCompletable.java:11–23  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

9
10public class QuittingCompletable {
11 public static void main(String[] args) {
12 List<QuittableTask> tasks =
13 IntStream.range(1, QuittingTasks.COUNT)
14 .mapToObj(QuittableTask::new)
15 .collect(Collectors.toList());
16 List<CompletableFuture<Void>> cfutures =
17 tasks.stream()
18 .map(CompletableFuture::runAsync)
19 .collect(Collectors.toList());
20 new Nap(1);
21 tasks.forEach(QuittableTask::quit);
22 cfutures.forEach(CompletableFuture::join);
23 }
24}
25/* Output:
266 7 5 9 11 12 13 14 15 16 17 18 19 20 21 22 23 10 24 26

Callers

nothing calls this directly

Calls 2

rangeMethod · 0.80
streamMethod · 0.45

Tested by

no test coverage detected