code: public void dispatch() {
      // iterate by index to avoid concurrent modification exceptions
      for (int i = 0; i < listeners.size(); i++) {
        listeners.get(i).dispatch();
      }
    }
docs: Dispatches all events enqueued prior to this call, serially and in order, for every listener.
  
  <p>Note: this method is idempotent and safe to call from any thread