code: public void addListener(EventListener l) {
          if (l == null) {
              throw new NullPointerException();
          }
  
          if (acceptsListener(l)) {
              synchronized (notifyLock) {
                  if (listeners == null) {
                      listeners = new ArrayList<EventListener>();
                  } else {
                      // identity equality check
                      for (EventListener ll : listeners) {
                          if (ll == l) {
                              return;
                          }
                      }
                  }
  
                  listeners.add(l);
              }
          } else {
              throw new IllegalStateException("Listener invalid for this notifier.");
          }
      }
docs: Add a listener to be notified when notifyChanged is called.
  The listener must not be null. AcceptsListener must return
  true for the listener.  Attempts to concurrently
  register the identical listener more than once will be
  silently ignored.