func adjacentPairs() -> AdjacentPairsSequence<Self>
Returns a sequence of overlapping adjacent pairs of the elements of this sequence.
func compacted<Unwrapped>() -> CompactedSequence<Self, Unwrapped>
Returns a new Sequence
that iterates over every non-nil element from the original Sequence
.
func firstNonNil<Result>((Element) throws -> Result?) rethrows -> Result?
Returns the first non-nil
result obtained from applying the given transformation to the elements of the sequence.
func grouped<GroupKey>(by: (Element) throws -> GroupKey) rethrows -> [GroupKey : [Element]]
Groups up elements of self
into a new Dictionary, whose values are Arrays of grouped elements, each keyed by the group key returned by the given closure.
func interspersed(with: Element) -> InterspersedSequence<Self>
Returns a sequence containing elements of this sequence with the given separator inserted in between each element.
func max(count: Int, sortedBy: (Element, Element) throws -> Bool) rethrows -> [Element]
Returns the largest elements of this sequence, as sorted by the given predicate.
func min(count: Int, sortedBy: (Element, Element) throws -> Bool) rethrows -> [Element]
Returns the smallest elements of this sequence, as sorted by the given predicate.
func minAndMax(by: (Element, Element) throws -> Bool) rethrows -> (min: Element, max: Element)?
Returns both the minimum and maximum elements in the sequence, using the given predicate as the comparison between elements.
func partitioned(by: (Element) throws -> Bool) rethrows -> (falseElements: [Element], trueElements: [Element])
Returns two arrays containing, in order, the elements of the sequence that do and don’t satisfy the given predicate.
func randomSample(count: Int) -> [Element]
Randomly selects the specified number of elements from this sequence.
func randomSample<G>(count: Int, using: inout G) -> [Element]
Randomly selects the specified number of elements from this sequence.
func reductions((Element, Element) throws -> Element) rethrows -> [Element]
Returns an array containing the accumulated results of combining the elements of the sequence using the given closure.
func reductions<Result>(Result, (Result, Element) throws -> Result) rethrows -> [Result]
Returns an array containing the accumulated results of combining the elements of the sequence using the given closure.
func reductions<Result>(into: Result, (inout Result, Element) throws -> Void) rethrows -> [Result]
Returns an array containing the accumulated results of combining the elements of the sequence using the given closure.
func striding(by: Int) -> StridingSequence<Self>
Returns a sequence stepping through the elements every step
starting at the first value. Any remainders of the stride will be trimmed.
func uniqued<Subject>(on: (Element) throws -> Subject) rethrows -> [Element]
Returns an array with the unique elements of this sequence (as determined by the given projection), in the order of the first occurrence of each unique element.