maxBy<R extends Comparable> method
T?
maxBy<R extends Comparable>(
- R f(
- T
Returns the element with the maximum value of f, or null if empty.
Implementation
T? maxBy<R extends Comparable<dynamic>>(R Function(T) f) {
if (isEmpty) return null;
return reduce((a, b) => f(a).compareTo(f(b)) >= 0 ? a : b);
}