maxBy
maxBy(list: List<T>, selector: T -> U) : T? for any types T and U.
maxBy(list, selector): returns the greatest item in the list,
where items are ordered by the value returned by applying selector to the item.
For example, if the following function has been declared
getRoutePrefix(route) = route.prefix; // Gets the prefix of a IpEntry route,
and if routes is a variable referring to some list of IpEntry records,
then maxBy(routes, getRoutePrefix) evaluates to the route with the largest prefix (aka subnet).
See how comparisons work for more on how subnets are ordered.
Similar to max and min, this function returns null if there are no items in the list.