Code example for CopyOnWriteArraySet

0
 * @param <T> 
 */ 
public class ListenerList<T> implements Iterable<T> {
 
 
	private final Collection<T> mListeners = new CopyOnWriteArraySet<T>();
 
	public void addListener(final T listener) {
		mListeners.add(listener);
	} 
 
	public void removeListener(final T listener) {
		mListeners.remove(listener);
	} 
 
	public void clearListeners() { 
		mListeners.clear();
	} 
 
	public Iterable<T> getListeners() {
		return Collections.unmodifiableCollection(mListeners);