Set (Swift)
E820426
Set (Swift) is a generic, unordered collection type in the Swift standard library that stores unique values of the same type with efficient membership and set-operation support.
Statements (54)
| Predicate | Object |
|---|---|
| instanceOf |
generic collection type
ⓘ
struct ⓘ value type ⓘ |
| allowsDuplicates | false ⓘ |
| conformsTo |
Collection
ⓘ
CustomDebugStringConvertible NERFINISHED ⓘ CustomStringConvertible NERFINISHED ⓘ Decodable ⓘ Encodable ⓘ ExpressibleByArrayLiteral NERFINISHED ⓘ Hashable ⓘ Sequence ⓘ SetAlgebra NERFINISHED ⓘ |
| defaultInitializer | init() ⓘ |
| definedIn | Swift Standard Library NERFINISHED ⓘ |
| elementConstraint | Hashable ⓘ |
| genericParameter | Element ⓘ |
| hasProperty |
Hash-based storage
ⓘ
amortized O(1) insertions ⓘ amortized O(1) membership checks ⓘ amortized O(1) removals ⓘ |
| initializer |
init(_:) from a sequence
ⓘ
init(arrayLiteral:) via array literal syntax ⓘ |
| introducedIn | Swift 1.0 ⓘ |
| isCopyOnWrite | true ⓘ |
| isOrdered | false ⓘ |
| isValueSemantics | true ⓘ |
| iterationOrder | unspecified ⓘ |
| literalSyntaxExample | let s: Set<Int> = [1, 2, 3] ⓘ |
| module | Swift NERFINISHED ⓘ |
| mutatingMethod |
insert(_:) -> (inserted: Bool, memberAfterInsert: Element)
ⓘ
remove(_:) -> Element? ⓘ update(with:) -> Element? ⓘ |
| property |
count: Int
ⓘ
first: Element? ⓘ isEmpty: Bool ⓘ |
| stores | unique values ⓘ |
| subscriptAccess | no index-based subscript ⓘ |
| supportsOperation |
contains
ⓘ
insert ⓘ intersection ⓘ isDisjoint(with:) ⓘ isStrictSubset(of:) ⓘ isStrictSuperset(of:) ⓘ isSubset(of:) ⓘ isSuperset(of:) ⓘ membership test ⓘ remove ⓘ subtracting ⓘ symmetricDifference ⓘ union ⓘ |
| useCase |
ensuring uniqueness in collections
ⓘ
modeling mathematical sets ⓘ testing membership efficiently ⓘ |
Referenced by (1)
Full triples — surface form annotated when it differs from this entity's canonical label.