Code example for CopyOnWriteArraySet

0
package net.cyclestreets; 
 
import java.util.Set; 
import java.util.concurrent.CopyOnWriteArraySet; 
 
import com.nutiteq.components.WgsPoint; 
import com.nutiteq.listeners.MapListener; 
 
public class WrapperMapListener implements MapListener { 
	protected Set<MapListener> listeners = new CopyOnWriteArraySet<MapListener>();		
 
 
	public WrapperMapListener() { 
	} 
	 
	public WrapperMapListener(MapListener ml) {
		addListener(ml);
	} 
	 
	public void addListener(MapListener ml) {
		listeners.add(ml);
	} 
 
	public MapListener[] getListeners() { 
		return listeners.toArray(new MapListener[0]);