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>
3.2 KiB
3.2 KiB
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(_:)-9cgksSwift/Set/init(_:)-15hys
Inspecting a Set
Swift/Set/isEmpty-207wtSwift/Set/count-8ze93Swift/Set/capacity
Testing for Membership
Swift/Set/contains(_:)
Adding Elements
Swift/Set/insert(_:)-nadsSwift/Set/insert(_:)-yar4Swift/Set/update(with:)-2n6tkSwift/Set/update(with:)-7r2gSwift/Set/reserveCapacity(_:)
Removing Elements
Swift/Set/filter(_:)Swift/Set/remove(_:)-8p2tvSwift/Set/remove(_:)-4d3i1Swift/Set/removeFirst()Swift/Set/remove(at:)Swift/Set/removeAll(keepingCapacity:)
Combining Sets
Swift/Set/union(_:)Swift/Set/formUnion(_:)Swift/Set/intersection(_:)-1zh8fSwift/Set/intersection(_:)-6uts9Swift/Set/formIntersection(_:)Swift/Set/symmetricDifference(_:)Swift/Set/formSymmetricDifference(_:)-22p0mSwift/Set/formSymmetricDifference(_:)-5u38bSwift/Set/subtract(_:)-8gc48Swift/Set/subtract(_:)-7cd3ySwift/Set/subtracting(_:)-3n4lcSwift/Set/subtracting(_:)-2qge3
Comparing Sets
Swift/Set/==(_:_:)Swift/Set/!=(_:_:)Swift/Set/isSubset(of:)-1d7ppSwift/Set/isSubset(of:)-6qyo5Swift/Set/isStrictSubset(of:)-96vc3Swift/Set/isStrictSubset(of:)-787sxSwift/Set/isSuperset(of:)-9iz62Swift/Set/isSuperset(of:)-90hriSwift/Set/isStrictSuperset(of:)-4d27mSwift/Set/isStrictSuperset(of:)-58ejgSwift/Set/isDisjoint(with:)-8ngmkSwift/Set/isDisjoint(with:)-2onid
Accessing Individual Elements
Swift/Set/firstSwift/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(_:)-i3mySwift/Set/flatMap(_:)-6chuhSwift/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
Encoding and Decoding
Swift/Set/encode(to:)Swift/Set/init(from:)
Describing a Set
Swift/Set/hash(into:)Swift/Set/descriptionSwift/Set/debugDescriptionSwift/Set/customMirror
Supporting Types
Swift/Set/IndexSwift/Set/Iterator
Infrequently Used Functionality
Swift/Set/init(arrayLiteral:)-3uja4Swift/Set/withContiguousStorageIfAvailable(_:)