Skip to content

Instantly share code, notes, and snippets.

@iscrz
Created January 15, 2017 20:47
Show Gist options
  • Save iscrz/97732b9526d019884debc0c0f92aa7d4 to your computer and use it in GitHub Desktop.
Save iscrz/97732b9526d019884debc0c0f92aa7d4 to your computer and use it in GitHub Desktop.
extension Array where Element : Comparable {
func sorted(after element: Element) -> [Element] {
return self.sorted { (a, b) -> Bool in
if a >= element && b < element {
return a > b
}
return a < b
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment