     public static function union(a:Set, b:Set):Set
     {
         var newSet:Set = a.clone();
-        newSet.addIterable(b.dict);
+
+        if (a !== b)
+            newSet.addIterable(b.dict);
+
         return newSet;
     }
 

    public function removeIterable(iterable:*):void
    {
        var item:*;
        for each (item in iterable)
            remove(item);
    }

    /**
     * Removes some element from the Set and returns it.  Exactly which
     * element is returned is undefined, as the Set is unordered.
     *
     * @return An element from the Set, or <code>null</code> if the Set is
     *         empty.

    public static function difference(a:Set, b:Set):Set
    {
        var newSet:Set = new Set();

        if (a !== b)
        {
            for each (var e:* in a.dict)
            {
                if (!b.contains(e)) newSet.add(e);
            }
        }
        return newSet;
    }
