OBSERVER_TYPE - The type of the observer hold by this set
public interface IObserverSet<OBSERVER_TYPE>
A set designed to hold observers when implementing the observer pattern
For this use case, the set has the following contract
1. Observers exists only once (its a set), adding them a second time will not modify the set
This will be done to avoid that listeners will be fired more than once in the case they was added accidently more than once.
This also ensures, that after invoking the remove() method the listener no longer remains in the set because it was added more
than once before accidently. This protects from heavy to find bugs where listeners was not removed correctly.
2. Iteration over the set is done in the same order the elements was added
It's reasonable to iterate always in the same order to avoid indeterministic behavior, e.g. to reproduce bugs.
3. Iteration is always done with a defensive copy, so changing the set while iterating over it is explicitly allowed,
but the iterator itself is unmodifiable. So changing the set while iterating over it must be done with add() and remove()
The are many cases where it is very practical the remove a listener while it will be invoked, e.g. on dispose or for binding
Implementations have not to be threadsafe. Implementors can assume that all modifications will be done
in the same thread and have not have to check the thread explicitly.