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

Ulf Zibis Ulf.Zibis at gmx.de
Tue Dec 21 14:01:41 UTC 2010


Am 21.12.2010 14:44, schrieb Ulf Zibis:
>
>         // As performance of Set's contains() is  less than O(N/2),
>         //  iteration is given to the remaining collection.
>         // For collections who's contains() are of the same complexity then
>         // best performance is achieved by iterating the smaller collection.
>         Collection<?>  iterate;
>         Collection<?>  contains;

Maybe better readable:
             // As mere Collection's contains() likely performs worse than
             // Set's, less than O(N/2), iterate on alternative/remaining collection.

> ... 2nd approach:

         if (c1 instanceof Set) {
             // As mere Collection's contains() likely performs worse than
             // Set's, less than O(N/2), iterate on c2.

-Ulf




More information about the core-libs-dev mailing list