mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
9ead8781d4
Co-authored-by: Alex Martini <amartini@apple.com> Co-authored-by: Graham Lee <glee23@apple.com> Co-authored-by: Chris Adamson <cadamson@apple.com> Co-authored-by: Kirby Turner <kirby_turner@apple.com> Co-authored-by: Paris Pinkney <ppinkney@apple.com> Co-authored-by: Dave Spector <dspector@apple.com> Co-authored-by: Sofia Rodriguez Morales <sofia_rodriguez@apple.com> Co-authored-by: Ethan Kusters <ekusters@apple.com> Co-authored-by: Goli Mohammadi <g_mohammadi@apple.com> Co-authored-by: Adora Vaz <a_vaz@apple.com> Co-authored-by: David Rönnqvist <ronnqvist@apple.com> Co-authored-by: Nate Merseth Cook <natecook@apple.com> Co-authored-by: Susan Conant <susan_c@apple.com>
136 lines
3.2 KiB
Markdown
136 lines
3.2 KiB
Markdown
# ``Swift/Set``
|
|
|
|
## Topics
|
|
|
|
### Creating a Set
|
|
|
|
In addition to using an array literal, you can also create a set using these initializers.
|
|
|
|
- ``Swift/Set/init()``
|
|
- ``Swift/Set/init(minimumCapacity:)``
|
|
- ``Swift/Set/init(_:)-9cgks``
|
|
- ``Swift/Set/init(_:)-15hys``
|
|
|
|
### Inspecting a Set
|
|
|
|
- ``Swift/Set/isEmpty-207wt``
|
|
- ``Swift/Set/count-8ze93``
|
|
- ``Swift/Set/capacity``
|
|
|
|
### Testing for Membership
|
|
|
|
- ``Swift/Set/contains(_:)``
|
|
|
|
### Adding Elements
|
|
|
|
- ``Swift/Set/insert(_:)-nads``
|
|
- ``Swift/Set/insert(_:)-yar4``
|
|
- ``Swift/Set/update(with:)-2n6tk``
|
|
- ``Swift/Set/update(with:)-7r2g``
|
|
- ``Swift/Set/reserveCapacity(_:)``
|
|
|
|
### Removing Elements
|
|
|
|
- ``Swift/Set/filter(_:)``
|
|
- ``Swift/Set/remove(_:)-8p2tv``
|
|
- ``Swift/Set/remove(_:)-4d3i1``
|
|
- ``Swift/Set/removeFirst()``
|
|
- ``Swift/Set/remove(at:)``
|
|
- ``Swift/Set/removeAll(keepingCapacity:)``
|
|
|
|
### Combining Sets
|
|
|
|
- ``Swift/Set/union(_:)``
|
|
- ``Swift/Set/formUnion(_:)``
|
|
- ``Swift/Set/intersection(_:)-1zh8f``
|
|
- ``Swift/Set/intersection(_:)-6uts9``
|
|
- ``Swift/Set/formIntersection(_:)``
|
|
- ``Swift/Set/symmetricDifference(_:)``
|
|
- ``Swift/Set/formSymmetricDifference(_:)-22p0m``
|
|
- ``Swift/Set/formSymmetricDifference(_:)-5u38b``
|
|
- ``Swift/Set/subtract(_:)-8gc48``
|
|
- ``Swift/Set/subtract(_:)-7cd3y``
|
|
- ``Swift/Set/subtracting(_:)-3n4lc``
|
|
- ``Swift/Set/subtracting(_:)-2qge3``
|
|
|
|
### Comparing Sets
|
|
|
|
- ``Swift/Set/==(_:_:)``
|
|
- ``Swift/Set/!=(_:_:)``
|
|
- ``Swift/Set/isSubset(of:)-1d7pp``
|
|
- ``Swift/Set/isSubset(of:)-6qyo5``
|
|
- ``Swift/Set/isStrictSubset(of:)-96vc3``
|
|
- ``Swift/Set/isStrictSubset(of:)-787sx``
|
|
- ``Swift/Set/isSuperset(of:)-9iz62``
|
|
- ``Swift/Set/isSuperset(of:)-90hri``
|
|
- ``Swift/Set/isStrictSuperset(of:)-4d27m``
|
|
- ``Swift/Set/isStrictSuperset(of:)-58ejg``
|
|
- ``Swift/Set/isDisjoint(with:)-8ngmk``
|
|
- ``Swift/Set/isDisjoint(with:)-2onid``
|
|
|
|
### Accessing Individual Elements
|
|
|
|
- ``Swift/Set/first``
|
|
- ``Swift/Set/randomElement()``
|
|
- ``Swift/Set/randomElement(using:)``
|
|
|
|
### Finding Elements
|
|
|
|
- ``Swift/Set/subscript(_:)``
|
|
- ``Swift/Set/contains(where:)``
|
|
- ``Swift/Set/allSatisfy(_:)``
|
|
- ``Swift/Set/first(where:)``
|
|
- ``Swift/Set/firstIndex(of:)``
|
|
- ``Swift/Set/firstIndex(where:)``
|
|
- ``Swift/Set/index(of:)``
|
|
- ``Swift/Set/min()``
|
|
- ``Swift/Set/min(by:)``
|
|
- ``Swift/Set/max()``
|
|
- ``Swift/Set/max(by:)``
|
|
|
|
### Transforming a Set
|
|
|
|
- ``Swift/Set/compactMap(_:)``
|
|
- ``Swift/Set/flatMap(_:)-i3my``
|
|
- ``Swift/Set/flatMap(_:)-6chuh``
|
|
- ``Swift/Set/reduce(_:_:)``
|
|
- ``Swift/Set/reduce(into:_:)``
|
|
- ``Swift/Set/sorted()``
|
|
- ``Swift/Set/sorted(by:)``
|
|
- ``Swift/Set/shuffled()``
|
|
- ``Swift/Set/shuffled(using:)``
|
|
- ``Swift/Set/lazy``
|
|
|
|
### Iterating over a Set
|
|
|
|
- ``Swift/Set/enumerated()``
|
|
- ``Swift/Set/forEach(_:)``
|
|
- ``Swift/Set/makeIterator()``
|
|
- ``Swift/Set/underestimatedCount-4ggqw``
|
|
|
|
### Performing Collection Operations
|
|
|
|
- <doc:order-dependent-operations-on-set>
|
|
|
|
### Encoding and Decoding
|
|
|
|
- ``Swift/Set/encode(to:)``
|
|
- ``Swift/Set/init(from:)``
|
|
|
|
### Describing a Set
|
|
|
|
- ``Swift/Set/hash(into:)``
|
|
- ``Swift/Set/description``
|
|
- ``Swift/Set/debugDescription``
|
|
- ``Swift/Set/customMirror``
|
|
|
|
### Supporting Types
|
|
|
|
- ``Swift/Set/Index``
|
|
- ``Swift/Set/Iterator``
|
|
|
|
### Infrequently Used Functionality
|
|
|
|
- ``Swift/Set/init(arrayLiteral:)-3uja4``
|
|
- ``Swift/Set/withContiguousStorageIfAvailable(_:)``
|