doc{"Returns the first ${f.element} having the smallest value according to the provided [comparator] or `null` if there are no ${f.element.pluralize()}."}
doc{"Returns the first ${f.element} having the largest value according to the provided [comparator] or `null` if there are no ${f.element.pluralize()}."}
returns("T?")
body{
"""
val iterator = iterator()
if (!iterator.hasNext()) return null
var max = iterator.next()
doc{"Returns the first ${f.element} having the ${if (op == "maxWith") "largest" else "smallest"} value according to the provided [comparator] or `null` if there are no ${f.element.pluralize()}."}