Create new composite listener for a collection of delegates.
494873
@SafeVarargs
    public static <T extends ParseTreeListener> T create(Class<T> type, T... delegates) {
        ImmutableList<T> listeners = ImmutableList.copyOf(delegates);
        return Reflection.newProxy(type, new AbstractInvocationHandler() {

            @Override
            @ParametersAreNonnullByDefault
            protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
                for (T listener : listeners) {
                    method.invoke(listener, args);
                }
                return null;
            }

            @Override
            public String toString() {
                return MoreObjects.toStringHelper("CompositeParseTreeListener")
                        .add("listeners", listeners)
                        .toString();
            }
        });

    }
331251
function(type, handler) {
      if (!this.listeners_)
        this.listeners_ = Object.create(null);
      if (!(type in this.listeners_)) {
        this.listeners_[type] = [handler];
      } else {
        var handlers = this.listeners_[type];
        if (handlers.indexOf(handler) < 0)
          handlers.push(handler);
      }
    }
1261698
public void registerListenersOnEverything(final Object object) {
        try {
            // the removeListener() call ensures that the listener is not added more than once
            new PropertyVisitor(object) {
                @Override
                protected boolean visitSingleValueProperty(final Property<?> fieldValue) {
                    fieldValue.removeListener(propertyListener);
                    fieldValue.addListener(propertyListener);
                    return true;
                }

                @Override
                protected boolean visitCollectionProperty(final ListProperty<?> fieldValue) {
                    fieldValue.removeListener(listListener);
                    fieldValue.addListener(listListener);
                    return true;
                }

                @Override
                protected boolean visitCollectionProperty(final MapProperty<?, ?> fieldValue) {
                    fieldValue.removeListener(mapListener);
                    fieldValue.addListener(mapListener);
                    return true;
                }

                @Override
                protected boolean visitCollectionProperty(final SetProperty<?> fieldValue) {
                    fieldValue.removeListener(setListener);
                    fieldValue.addListener(setListener);
                    return false;
                }
            };
        } catch (final IllegalAccessException e) {
            topology.onError(new SynchronizeFXException(e));
        } catch (final SecurityException e) {
            topology.onError(new SynchronizeFXException(
                    "Maybe you're JVM doesn't allow reflection for this application?", e));
        }
    }
952748
public void setListeners(Collection<CustomizationSupplier<CacheEntryOperationListener<K,V>>> c) {
    getListeners().addAll(c);
  }
866372
public void setListeners(java.util.Collection<Listener> listeners) {
        if (listeners == null) {
            this.listeners = null;
            return;
        }

        this.listeners = new java.util.ArrayList<Listener>(listeners);
    }
1140432
function filterListeners (listenerCollection) {
        return function(filters) {
            var handlers = [];

            _.each(listenerCollection, function(listener){
                handlers = handlers.concat( findMatch(filters, listener) );
            });

            return handlers;
        };
    }
1184619
private OnMultiChoiceClickListener createListItemListener() {
        return new OnMultiChoiceClickListener() {

            @Override
            public void onClick(final DialogInterface dialog, final int which,
                                final boolean isChecked) {
                if (isChecked) {
                    selectedIndices.add(which);
                } else {
                    selectedIndices.remove(which);
                }
            }

        };
    }
645031
function ( obj, event, st ) {
		observer.alisteners[obj][event][st] = array.cast( observer.listeners[obj][event][st] );
	}
403439
function listenCollection(collection, listener) {
    collection.forEach(function listenModel(model) {
        listen(model, listener);
    });

    collection.on('add', function onAdd(model) {
        listen(model, listener);
        listener();
    });
}
1169019
def add_listener(self, name, listener, priority=0):
        
        if name not in self.listeners:
            self.listeners[name] = []

        self.listeners[name].append((listener, priority))

        # reorder event
        self.listeners[name].sort(key=lambda listener: listener[1], reverse=True)
884015
function(event_name) {

		this._event_listeners[event_name] = this._createEventWrapper(event_name);

		if ((event_name in this._dom_event_support) && this._dom_event_support[event_name].delegation) {

			Firestorm.Element.addDelegation(window, event_name, '*', this._event_listeners[event_name]);

		} else {

			Firestorm.Element.addListener(window, event_name, this._event_listeners[event_name]);

		}

	}
1186505
public void addObservableListener(ObservableListener<T> listener)
	{
		checkNotNull(listener, "listener cannot be null");

		listeners.add(ObservableListener.class, listener);
	}
722792
def _get_listeners(instance, change):
    """"""
    if (
            change['mode'] not in listeners_disabled._quarantine and           #pylint: disable=protected-access
            change['name'] in instance._listeners
    ):
        return instance._listeners[change['name']][change['mode']]
    return []
599337
function listener (event, done) {
  return function onevent (arg1) {
    var args = new Array(arguments.length)
    var ee = this
    var err = event === 'error'
      ? arg1
      : null

    // copy args to prevent arguments escaping scope
    for (var i = 0; i < args.length; i++) {
      args[i] = arguments[i]
    }

    done(err, ee, event, args)
  }
}
317016
@SuppressWarnings("unchecked")
    private void prepareListeners() {
        if (preparedListeners != null && preparedUnspecifiedListeners != null) {
            // Already created, skip
            return;
        }
        preparedListeners = new ConcurrentHashMap<>();
        Stream<Class<? extends GloballyAttachableListener>> eventTypes = Stream.concat(
                listeners.keySet().stream(),
                Stream.concat(listenerSuppliers.keySet().stream(),
                        listenerFunctions.keySet().stream())
        ).distinct();
        eventTypes.forEach(type -> {
            ArrayList<Function<DiscordApi, GloballyAttachableListener>> typeListenerFunctions = new ArrayList<>();
            listeners.getOrDefault(type, Collections.emptyList()).forEach(
                    listener -> typeListenerFunctions.add(api -> listener)
            );
            listenerSuppliers.getOrDefault(type, Collections.emptyList()).forEach(
                    supplier -> typeListenerFunctions.add(api -> supplier.get())
            );
            listenerFunctions.getOrDefault(type, Collections.emptyList()).forEach(
                    function -> typeListenerFunctions.add((Function<DiscordApi, GloballyAttachableListener>) function)
            );
            preparedListeners.put(type, typeListenerFunctions);
        });
        // Unspecified Listeners
        preparedUnspecifiedListeners = new CopyOnWriteArrayList<>(unspecifiedListenerFunctions);
        unspecifiedListenerSuppliers.forEach(supplier -> preparedUnspecifiedListeners.add((api) -> supplier.get()));
        unspecifiedListeners.forEach(listener -> preparedUnspecifiedListeners.add((api) -> listener));
    }
1350477
protected final void notifyListeners() {
        Iterator<SMTPClientFutureListener<E>> it = null;
        synchronized (this) {
            if (listeners != null) {
                // notify the listeners
                it  = listeners.iterator();

                listeners = null;
            }
        }
        if (it != null) {
            while(it.hasNext()) {
                SMTPClientFutureListener<E> listener = null;
                try {
                    listener = it.next();
                    listener.operationComplete(this);
                } catch (Throwable e) {
                    LOGGER.warn("Exception thrown while executing " + SMTPClientFutureListener.class.getName() + " " + listener, e);
                }
            }
        }
    }
975191
private void delegateChanged(Observable<T> oldDelegate, Observable<T> newDelegate)
	{
		removeObservableListeners(oldDelegate);
		
		addObservableListeners(newDelegate);

		support.fireValueChanged(oldDelegate.getValue(), newDelegate.getValue());
	}