[concurrency-interest] Review for CR 6728865 : Improved heuristics for Collections.disjoint() [updated]

Chris Hegarty chris.hegarty at oracle.com
Wed Dec 22 10:45:23 EST 2010


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
>


More information about the Concurrency-interest mailing list