sortBy

trait Collection[A] {
  def sortBy[W](f: (A) => W): Collection[A]
}

sortBy creates a collection with the elements sorted by the results yielded by f after being applied to each element.