Class that can hold the list of event listeners
in a "weak" manner. The advantage is that the listener
doesn't need to be explicitly removed. Because of the use
of the WeakReference it gets forgotten
automatically if it was garbage collected. There must
be at least one non-weak reference to the listener
(otherwise it would become garbage-collected).
One of the ways is to store the listener in some instance
variable in the class that adds the listener.
Please note that the methods getListenerCount()
and getListenerCount(Class t) give the count
that doesn't reflect whether some listeners were garbage