Collection

extension Collection where Iterator.Element: Comparable

Available where Iterator.Element: Comparable

  • Obtain the min and max values in a collection.

    Declaration

    Swift

    public func minMax() -> (min: Iterator.Element, max: Iterator.Element)?

    Return Value

    2-tuple with the minimum and maximum values or nil if collection is empty