         return countElements(self._internalDict)
     }
 
-    // Implement Collection (allows for "countElements(set)", etc.)
-    subscript (i: Int) -> T {
-        return Array(self._internalDict.values)[i]
-    }
-
-    // Implement Sequence (allows for "for x in set")
-    func generate() -> IndexingGenerator<[T]> {
-        return Array(self._internalDict.values).generate()
+    // Implement ExtensibleCollection
+    func reserveCapacity(n: Int) {
+        // NOOP.
+    }
+
+    // Implement ExtensibleCollection
+    func extend<R : Sequence where R.GeneratorType.Element == T>(sequence: R) {
+        var elements = Array<T>(sequence)
+        for element in elements {
+            self.add(element)
+        }
+    }
+
+    // Implement Hashable
+    var hashValue: Int {
+        var totalHash = 0
+        for entry in self {
+            totalHash += entry != nil ? entry.hashValue : 0
+        }
+        return totalHash
+    }
+
+    // Implement LogicValue (allows for "if set { … }")
+    func getLogicValue() -> Bool {
+        return countElements(self) != 0
     }
 
     // Implement Printable (allows for "println(set)")

        return s
    }

    // Implement ArrayLiteralConvertible (allows for "var set: Set<Int> = [2, 4, 8]")
    class func convertFromArrayLiteral(elements: T...) -> Set<T> {
        return Set(elements)
    }

    // Implement LogicValue (allows for "if set { … }")
    func getLogicValue() -> Bool {
        return countElements(self) != 0
    }

    // Implement ExtensibleCollection
    func reserveCapacity(n: Int) {
        // NOOP.
    }

    // Implement ExtensibleCollection
    func extend<R : Sequence where R.GeneratorType.Element == T>(sequence: R) {
        var elements = Array<T>(sequence)
        for element in elements {
            self.add(element)
        }
    }

    // Implement Hashable
    var hashValue: Int {
        var totalHash = 0
        for entry in self {
            totalHash += entry != nil ? entry.hashValue : 0
        }
        return totalHash
    }
}

class set<T: Hashable> : Set<T> {
    init() {
        super.init()
    }

    init(_ initialArray: [T]) {
        super.init(initialArray)
    }

    init(_ initialSet: Set<T>) {
        super.init(initialSet)
    }

    init(_ initialSet: set<T>) {
        super.init(initialSet)
    }
}

func <<T: Hashable>(lhs: Set<T>, rhs: Set<T>) -> Bool {
    if lhs == rhs {
        return false

@assignment func -=<T: Hashable>(inout lhs: Set<T>, rhs: T) {
    lhs.remove(rhs)
}

// set(…) for Python compatibility.
class set<T: Hashable> : Set<T> {
    init() {
        super.init()
    }

    init(_ initialArray: [T]) {
        super.init(initialArray)
    }

    init(_ initialSet: Set<T>) {
        super.init(initialSet)
    }

    init(_ initialSet: set<T>) {
        super.init(initialSet)
    }
}
