commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack, Paul" <>
Subject RE: [collection] Collections for primitives
Date Tue, 25 Jun 2002 16:58:25 GMT
> Yes, I remember arguing before in this thread that false was 
> more useful
> than an exception for contains(Object). Also -1 for indexOf() 
> and false for
> remove(). So yes I would like to see the primitive 
> collections changed.

What do you think of having an additional set of decorators
for making "fail-fast" collections permissive?  Eg, a 
decorator whose contains(Object) method looks like:

   public boolean contains(Object o) {
       try {
           return innerCollection.contains(o);
       } catch (ClassCastException e) {
           return false;
       } catch (IllegalArgumentException e) {
           return false;
       } catch (NullPointerException e) {
           return false;

Then if the primitive and Predicate collections were written
to be fail-fast, and that behavior was not desired, then users
could use the new decorators to eliminate it.


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

View raw message