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

Mike Duigou mike.duigou at
Mon Jan 3 20:16:02 UTC 2011

On Dec 24 2010, at 17:32 , Ulf Zibis wrote:

> Trying to correct white space ...
> Am 23.12.2010 23:59, schrieb Paul Benedict:
>> Ulf, a previous email by Remi said only to invoke size() if the collection is a Set.
> Thanks I missed that.
> My guess was, that size() should be always faster than instantiating an iterator for the final for-loop, and then seeing, that there is no element.

An earlier webrev had an isEmpty() check in the "c1 is a Set" half of the branch. This optimization would pay off in some cases but cost a small amount in others. Since I don't have any strong sense of whether including it would be of actual benefit or harm I opted to take it out in later revisions.


More information about the core-libs-dev mailing list