     public static function intersection(a:Set, b:Set):Set
     {
         var item:*;
-        var newSet:Set = new Set();
-
-        for each (item in a.dict)
-            if (b.contains(item))
-                newSet.add(item);
+        var newSet:Set;
+
+        if (a === b)
+        {
+            return a.clone();
+        }
+        else
+        {
+            newSet = new Set();
+            for each (item in a.dict)
+                if (b.contains(item))
+                    newSet.add(item);
+        }
 
         return newSet;
     }

    {
        var item:*;

        if (_length != other._length) return false;

        for each (item in dict)
            if (!other.contains(item)) return false;

        return true;
    }

    /**

    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;
    }
