func adjacentPairs() -> AdjacentPairsCollection<Self>
Returns a collection of overlapping adjacent pairs of the elements of this collection.
func chunked(by: (Element, Element) throws -> Bool) rethrows -> [SubSequence]
Returns a collection of subsequences of this collection, chunked by the given predicate.
func chunked<Subject>(on: (Element) throws -> Subject) rethrows -> [(Subject, SubSequence)]
Returns a collection of subsequences of this collection, chunked by grouping elements that project to equal values.
func chunks(ofCount: Int) -> ChunksOfCountCollection<Self>
Returns a collection of subsequences, each with up to the specified length.
func combinations(ofCount: Int) -> CombinationsSequence<Self>
Returns a collection of combinations of this collection’s elements, with each combination having the specified number of elements.
func combinations<R>(ofCount: R) -> CombinationsSequence<Self>
Returns a collection of combinations of this collection’s elements, with each combination having the specified number of elements.
func cycled() -> CycledSequence<Self>
Returns a sequence that repeats the elements of this collection forever.
func cycled(times: Int) -> CycledTimesCollection<Self>
Returns a sequence that repeats the elements of this collection the specified number of times.
func endOfPrefix(while: (Element) throws -> Bool) rethrows -> Index
Returns the exclusive upper bound of the prefix of elements that satisfy the predicate.
func evenlyChunked(in: Int) -> EvenlyChunkedCollection<Self>
Returns a collection of evenly divided consecutive subsequences of this collection.
func indexed() -> IndexedCollection<Self>
Returns a collection of pairs (i, x), where i represents an index of the collection, and x represents an element.
func max(count: Int, sortedBy: (Element, Element) throws -> Bool) rethrows -> [Element]
Returns the largest elements of this collection, as sorted by the given predicate.
func min(count: Int, sortedBy: (Element, Element) throws -> Bool) rethrows -> [Element]
Returns the smallest elements of this collection, as sorted by the given predicate.
func partitioned(by: (Element) throws -> Bool) rethrows -> (falseElements: [Element], trueElements: [Element])
Returns two arrays containing, in order, the elements of the collection that do and don’t satisfy the given predicate.
func partitioningIndex(where: (Element) throws -> Bool) rethrows -> Index
Returns the start index of the partition of a collection that matches the given predicate.
func permutations(ofCount: Int?) -> PermutationsSequence<Self>
Returns a collection of the permutations of this collection of the specified length.
func permutations<R>(ofCount: R) -> PermutationsSequence<Self>
Returns a collection of the permutations of this collection with lengths in the specified range.
func randomSample(count: Int) -> [Element]
Randomly selects the specified number of elements from this collection.
func randomSample<G>(count: Int, using: inout G) -> [Element]
Randomly selects the specified number of elements from this collection.
func randomStableSample(count: Int) -> [Element]
Randomly selects the specified number of elements from this collection, maintaining their relative order.
func randomStableSample<G>(count: Int, using: inout G) -> [Element]
Randomly selects the specified number of elements from this collection, maintaining their relative order.
func striding(by: Int) -> StridingCollection<Self>
Returns a sequence stepping through the elements every step
starting at the first value. Any remainders of the stride will be trimmed.
func trimmingPrefix(while: (Element) throws -> Bool) rethrows -> SubSequence
Returns a SubSequence
formed by discarding all elements at the start of the collection which satisfy the given predicate.
func windows(ofCount: Int) -> WindowsOfCountCollection<Self>
Returns a collection of all the overlapping slices of a given size.