1
JavaIntermediate#design-patterns
A behavioral pattern where an object (subject) maintains a list of dependents (observers) and notifies them automatically of state changes, commonly used for event-driven systems like GUI listeners or pub/sub systems.
interface Observer { void update(String event); }
class EventBus {
List<Observer> observers = new ArrayList<>();
void notifyAll(String event) { observers.forEach(o -> o.update(event)); }
}