MCPcopy Create free account
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

patterns/Macro.java:8–19  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

6
7public class Macro {
8 public static void main(String[] args) {
9 List<Runnable> macro = new ArrayList<>(
10 Arrays.asList(
11 () -> System.out.print("Hello "),
12 () -> System.out.println("World! ")
13 ));
14 macro.forEach(Runnable::run);
15 macro.add(
16 () -> System.out.print("I'm the command pattern!")
17 );
18 macro.forEach(Runnable::run);
19 }
20}
21/* Output:
22Hello World!

Callers

nothing calls this directly

Calls 2

printMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected