commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack, Paul" <pj...@sfaf.org>
Subject RE: [Collections] Release potential?
Date Sat, 17 Aug 2002 21:33:28 GMT
> > How ugly is it to allow these methods to accept a boolean flag
> > indicating whether or not duplicate elements are allowed?
> >
> >    Buffer BufferUtils.boundedBuffer(Buffer, int, boolean);
> >    Collection CollectionUtils.boundedCollection(Buffer, int, 
> >         boolean);
> 
> I think a boolean is insufficient. I may have a specialist 
> subclass of _any_ collection that only allows certain elements 
> to be added (eg.predicated collections). It sounds like Bounded 
> doesn't handle any of these cases ATM.  As for a solution, I can 
> only think of clone, add and check result - which isn't good!

Oh hell.  You're right, all collections are allowed to silently 
ignore illegal elements.

Well.  I actually use bounded stuff all the time ("The user specified 
a max of 100 sessions in the config file, so the global session map 
should never contain more than 100 entries").  I think it's a good 
sanity check, like the predicated decorators. 

Do we document that the bounded decorators won't work with things
that silently ignore illegal elements; do we eliminate the feature;
do we hack something...

Actually, I think I answered my own question.  It's a big enough 
issue that I think we should delay it until after the next release.

So, I'll take out the bounded stuff.  Curses!

-Paul



--
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