On 12/22/10 03:30 PM, Rémi Forax wrote:
...
Would it make sense to simply swallow the exception ( do nothing ) and
continue with the next element? Clearly if contains() throws and
Exception then the collection does not contain the given element?
I see,
but the same argument can be applied to contains() i.e why doesn't it
return false instead of throwing a NPE or a CCE ?
Good point. I guess it could be seen as programmer error test for null
in a collection that cannot possibly contain it. Although, these
exceptions are optional ( in some collections ).
For disjoint we don't have this (optional) constraint, and I'm not sure
if we should introduce it. Some implementations of disjoint() could
already be consuming any NPE/CFE.
I'm not saying that this is the right approach, I'm just wondering if we
considered this option.
-Chris
-Chris.
Rémi