commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lambrou <>
Subject Re: [collections] Classes that decorate collections with References?
Date Fri, 24 Dec 2004 10:09:34 GMT
Stephen Colebourne wrote:

> I am unsure as to the use case for a ReferenceList/ReferenceSet. We 
> already have ReferenceMap, which is very useful for building caches, 
> but why would you need a List/Set? How would they operate?

Well, here's an example, of the top of my head. A weakly referencing 
list could be useful for implementing the observer pattern in a 
situation where you don't want the listeners to be strongly referenced 
by the event source. If the event source uses such a list to hold its 
listeners, then as long as the listeners remain strongly referenced, 
they will continue to receive events from the source. There will be no 
need to explicitly unregister the listeners, as once they become weakly 
referenced, then they will effectively be removed from the event 
listener list automatically.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message