Collection

extension Collection
  • Finds such index N that predicate is true for all elements up to but not including the index N, and is false for all elements starting with index N. Behavior is undefined if there is no such N.

    Declaration

    Swift

    func binarySearch(predicate: (Iterator.Element) -> Bool) -> Index