Sequence

extension Sequence
extension Sequence where Element: Equatable
  • All of the values which are the least or greatest given the areInIncreasingOrder closure.

    Note

    Consider returning (Element, count: Int)? instead of Array.

    Declaration

    Swift

    public func extrema <T> (property: (Element) -> T, areInIncreasingOrder: (T,T) -> Bool)
        -> [Element] where T: Comparable
  • Declaration

    Swift

    public func min<T>(property: (Element) -> T) -> [Element] where T : Comparable

    Return Value

    All of the values which are equivalent to the minimum value contained herein.

  • Declaration

    Swift

    public func max<T>(property: (Element) -> T) -> [Element] where T : Comparable

    Return Value

    All of the values which are equivalent to the maximum value contained herein.

Available where Element: Equatable

  • Declaration

    Swift

    public var isHomogeneous: Bool { get }

    Return Value

    true if there are one or fewer elements in self, or if all elements in self are logically equivalent.

  • Declaration

    Swift

    public var isHeterogeneous: Bool { get }

    Return Value

    false if there are one or fewer elements in self, or if any elements in self are not logically equivalent.