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

Method main

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

Source from the content-addressed store, hash-verified

9public class PizzaStreams {
10 static final int QUANTITY = 5;
11 public static void main(String[] args) {
12 Timer timer = new Timer();
13 IntStream.range(0, QUANTITY)
14 .mapToObj(Pizza::new)
15 .parallel() // [1]
16 .forEach(za -> {
17 while(!za.complete())
18 za.next();
19 });
20 System.out.println(timer.duration());
21 }
22}
23/* Output:
24Pizza 0: ROLLED

Callers

nothing calls this directly

Calls 4

durationMethod · 0.95
rangeMethod · 0.80
completeMethod · 0.80
nextMethod · 0.65

Tested by

no test coverage detected