Code example for ArrayList

Methods: addAll, remove

0
     * Remove the given listener 
     * @param listener the listener to remove 
     */ 
    public void removeListener(T listener) {
        if (listeners != null) {
            List<T> newlisteners = new ArrayList<T>();
            newlisteners.addAll(listeners);
            newlisteners.remove(listener);
            listeners = newlisteners;
        } 
    } 
 
    /** 
     * Clear all listeners 
     */ 
    public void clearListeners() { 
        listeners = new ArrayList<T>();
    } 
 
    /** 
     * Get the ordered list of listeners ordered by dependencies