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

Reply via email to