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

Class Controller

innerclasses/controller/Controller.java:9–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7import java.util.*;
8
9public class Controller {
10 // A class from java.util to hold Event objects:
11 private List<Event> eventList = new ArrayList<>();
12 public void addEvent(Event c) { eventList.add(c); }
13 public void run() {
14 while(eventList.size() > 0)
15 // Make a copy so you're not modifying the list
16 // while you're selecting the elements in it:
17 for(Event e : new ArrayList<>(eventList))
18 if(e.ready()) {
19 System.out.println(e);
20 e.action();
21 eventList.remove(e);
22 }
23 }
24}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected