~/ learn/ comp-308/ cards/ Inner classes & control frameworks
1 of 6

Type the Controller event loop (polymorphic dispatch)

Type the Controller event loop (polymorphic dispatch)

Answer

for (Event e : new ArrayList<Event>(eventList)) if (e.ready()) { e.action(); eventList.remove(e); }

The framework never names a concrete event. e.action() dispatches polymorphically to the inner class's override; the copied list lets action() safely modify eventList.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/89c90851-296f-4d55-beaf-06ed29eff7a5/flashcard utf-8 LF