On Mon, Apr 19, 2004 at 10:50:39PM +0100, Stephen Colebourne wrote: > From: "Noel J. Bergman" <[EMAIL PROTECTED]> > > > > - ALL the Unmodifiable crap > > > > > I can understand this. The reason the classes exist is for > > > completeness and practicality. [collections] has interfaces > > > that are not in the JDK, and they need unmodifiable decorators > > > > Steve, this is where I was wondering about the approach used in the > [events] > > message posted today. Would that help, if applied consistently across > > [collections]? > Not really. Proxying would require a simple matching straegy. > > However, each collection has its own tricks when it comes to writing > decorators. For an unmodifiable map for example, you must trap the main map, > the keySet, the values collection and the entrySet. Plus you must trap the > setValue on exposed MapEntry objects from the entrySet iterator and the > toArray.
For maps, I agree with you. Still, for PredicatedCollection, I think a simple proxy would do wonders. Another possible use would be to have "interceptor" (borrowed from [HiveMind]) proxies, that performs not only checking (as for predicates), but also post- or pre- processing. I can't think of any example right now... maybe to implement some caching mechanism ontop of an existing collection? Stephen, I am currently packing my classes. I'll send you a link so you may have a look at my proxy stuff. Herve --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
