Perform order-dependent operations common to all collections, as implemented for Set
.
Framework
- Foundation
Perform order-dependent operations common to all collections, as implemented for Set
.
Framework
var start Index: Set<Element>.Index
The starting position for iterating members of the set.
var end Index: Set<Element>.Index
The “past the end” position for the set—that is, the position one greater than the last valid subscript argument.
func index(after: Set<Element>.Index) -> Set<Element>.Index
Returns the position immediately after the given index.
func form Index(after: inout Set<Element>.Index)
Replaces the given index with its successor.
func index(Set<Element>.Index, offset By: Int) -> Set<Element>.Index
Returns an index that is the specified distance from the given index.
func form Index(inout Set<Element>.Index, offset By: Int)
Offsets the given index by the specified distance.
func index(Set<Element>.Index, offset By: Int, limited By: Set<Element>.Index) -> Set<Element>.Index?
Returns an index that is the specified distance from the given index, unless that distance is beyond a given limiting index.
func form Index(inout Set<Element>.Index, offset By: Int, limited By: Set<Element>.Index) -> Bool
Offsets the given index by the specified distance, or so that it equals the given limiting index.
func distance(from: Set<Element>.Index, to: Set<Element>.Index) -> Int
Returns the distance between two indices.
var indices: Default Indices<Set<Element>>
The indices that are valid for subscripting the collection, in ascending order.
func elements Equal<Other Sequence>(Other Sequence) -> Bool
Returns a Boolean value indicating whether this sequence and another sequence contain the same elements in the same order.
func elements Equal<Other Sequence>(Other Sequence, by: (Element, Other Sequence .Element) -> Bool) -> Bool
Returns a Boolean value indicating whether this sequence and another sequence contain equivalent elements in the same order, using the given predicate as the equivalence test.
func lexicographically Precedes<Other Sequence>(Other Sequence) -> Bool
Returns a Boolean value indicating whether the sequence precedes another sequence in a lexicographical (dictionary) ordering, using the less-than operator (<
) to compare elements.
func lexicographically Precedes<Other Sequence>(Other Sequence, by: (Element, Element) -> Bool) -> Bool
Returns a Boolean value indicating whether the sequence precedes another sequence in a lexicographical (dictionary) ordering, using the given predicate to compare elements.
func starts<Possible Prefix>(with: Possible Prefix) -> Bool
Returns a Boolean value indicating whether the initial elements of the sequence are the same as the elements in another sequence.
func starts<Possible Prefix>(with: Possible Prefix, by: (Element, Possible Prefix .Element) -> Bool) -> Bool
Returns a Boolean value indicating whether the initial elements of the sequence are equivalent to the elements in another sequence, using the given predicate as the equivalence test.
subscript(Range<Set<Element>.Index>) -> Slice<Set<Element>>
Accesses a contiguous subrange of the collection’s elements.
subscript<R>(R) -> Slice<Set<Element>>
Accesses the contiguous subrange of the collection’s elements specified by a range expression.
func prefix(Int) -> Slice<Set<Element>>
Returns a subsequence, up to the specified maximum length, containing the initial elements of the collection.
func prefix(up To: Set<Element>.Index) -> Slice<Set<Element>>
Returns a subsequence from the start of the collection up to, but not including, the specified position.
func prefix(through: Set<Element>.Index) -> Slice<Set<Element>>
Returns a subsequence from the start of the collection through the specified position.
func prefix(while: (Element) -> Bool) -> Slice<Set<Element>>
Returns a subsequence containing the initial elements until predicate
returns false
and skipping the remaining elements.
func suffix(Int) -> Slice<Set<Element>>
Returns a subsequence, up to the given maximum length, containing the final elements of the collection.
func suffix(from: Set<Element>.Index) -> Slice<Set<Element>>
Returns a subsequence from the specified position to the end of the collection.
func drop(while: (Element) -> Bool) -> Slice<Set<Element>>
Returns a subsequence by skipping elements while predicate
returns true
and returning the remaining elements.
func drop First(Int) -> Slice<Set<Element>>
Returns a subsequence containing all but the given number of initial elements.
func drop Last(Int) -> Slice<Set<Element>>
Returns a subsequence containing all but the specified number of final elements.
func pop First() -> Element?
Removes and returns the first element of the set.
func reversed() -> [Element]
Returns an array containing the elements of this sequence in reverse order.
func joined() -> Flatten Sequence<Set<Element>>
Returns the elements of this sequence of sequences, concatenated.
func joined<Separator>(separator: Separator) -> Joined Sequence<Set<Element>>
Returns the concatenated elements of this sequence of sequences, inserting the given separator between each element.
func joined(separator: String) -> String
Returns a new string by concatenating the elements of the sequence, adding the given separator between each element.
func split(separator: Element, max Splits: Int, omitting Empty Subsequences: Bool) -> [Slice<Set<Element>>]
Returns the longest possible subsequences of the collection, in order, around elements equal to the given element.
func split(max Splits: Int, omitting Empty Subsequences: Bool, where Separator: (Element) -> Bool) -> [Slice<Set<Element>>]
Returns the longest possible subsequences of the collection, in order, that don’t contain elements satisfying the given predicate.