maxBy

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

maxBy applies f to each element and returns the element that yields the largest value.

On empty collections this function throws a UnsupportedOperationException exception.