commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@eurobell.co.uk>
Subject Re: [Collections][SUBMIT] WeakHashSet
Date Mon, 29 Apr 2002 21:17:24 GMT
From: Jack, Paul <pjack@sfaf.org>
To: 'Jakarta Commons Developers List' <commons-dev@jakarta.apache.org>
> Although it really does feel like we could provide some sort of
Transformer-
> based approach that would enable weak elements but also other
> functionality...
> Like...Before I mentioned a two-transformer approach.  If the "read"
> transformer (which would transform weak references back into their
referents
> before returning the value from the collection) emptied the reference
queue
> before returning results, the two-transformer approach would probably
work.

I'm not sure a two transformer approach is all thats needed. Collections
have three basic types of method:
- input (add/set)
- query (indexOf, contains, equals, remove)
- output (get, toArray)
The Predicate/Transform proposal covers only the input group at the moment.

A 'two transformer' approach would cover the output group of methods (but
would require another 7 classes to do it). This is perfectly possible, but
naming would be interesting :-)

> > Which brings me to another thought - Ultimately, this "weak reference
> > Collection wrapper," Transformers and Predicates are all collection
> wrappers
> > of one sort or another that encapsulate another collection that actually
> > stores the objects (or another wrapper).  Perhaps they should all
subclass
> > from the same class, or implement a common interface?
>
> There already exists a "ProxyMap" class for this purpose for Maps, and
> there's been talk of including "ProxyList", "ProxySet" etc.  My feeling
> is if you want to code them up, they'd be accepted.

I have looked at the ProxyMap. It is suitable for use by the Predicate and
Transform classes as it provides protected access to the map, but no public
method to access it. Thus ProxyList and ProxySet would also be useful.
However, that would still only cover 3 of the 7 collections!

At the moment I'm pausing on the implementation of the predicate/transform
classes until things clear.

Stephen


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message