(String[] args)
| 9 | public class PizzaParallelSteps { |
| 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() |
| 16 | .map(Pizza::roll) |
| 17 | .map(Pizza::sauce) |
| 18 | .map(Pizza::cheese) |
| 19 | .map(Pizza::toppings) |
| 20 | .map(Pizza::bake) |
| 21 | .map(Pizza::slice) |
| 22 | .map(Pizza::box) |
| 23 | .forEach(za -> System.out.println(za)); |
| 24 | System.out.println(timer.duration()); |
| 25 | } |
| 26 | } |
| 27 | /* Output: |
| 28 | Pizza 1: ROLLED |